-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💡 Override package.json and/or return used deps #882
Comments
Thank you for the kind words, Omid! Not sure if this useful for your use case, but I guess my main idea here is to eventually expose the module and dependency knip/packages/knip/src/index.ts Line 636 in ea478f5
...does that contain the information you need? The idea is that you can then build on top of this graph any way you need. Unfortunately we're not there yet, but it's still useful to know already if this use case would fit. |
Hey @webpro thanks for the quick reply! Just taking a look at this now - finishing up at work for xmas so it's been a busy day... Sorry if I've misunderstood — I added the I think that would probably solve my use-case though, just going off the name |
Sorry I wasn't clear, I meant to call inspect(graph) to log the graph so you can see what it contains. |
Hmm yeah, I tried adding that directly under |
I was just editing the file directly inside I've just cloned the repo and if i run As you said you're not quite there yet with this feature, what else is left to do? Thanks a lot for your patience with me! 🙂 |
Nice, feedback like this helps to understand its potential better. Feel free to indicate if something's missing or would be cumbersome to use.
See
It's mostly that exposing this might mean more efforts and maintenance for me. Also see https://knip.dev/reference/faq#why-doesnt-knip-have
Always, love this project as it helps people making maintenance easier and more fun. |
Suggest an idea for Knip
Hey! I'm new to knip but I've been really impressed with it so far, so firstly just wanted to say thanks for the time and effort in maintaining this. It's an awesome tool ❤️
So, I have a potentially weird use-case... At the moment, if I run knip against a bunch of built files, anything that is explicitly added as dependency in package.json is (correctly) not deemed to be missing.
But lets say I'm less concerned with whether or not imports are actually deemed to be "missing", I just want to get back a list of all the imports from statically analysing a bunch of files. The idea being that i can then use that list of modules to know exactly what should be in a stripped-back
node_modules
folder.I can get this to work in a rudimentary way simply by commenting out this line. Of course doing that, everything is grouped under "unlisted".
There's more than one way to solve this I think:
package
object to override the localpackage.json
— depcheck exposes this option, and it works welllisted
deps as well asunlisted
— but I appreciate this isn't the problem knip sets out to solve. But it could still be useful for folks who want to analyse imports and still get the other benefits knip bringsI'd be happy to open a PR for this if I can get it working. Apologies if this has been asked before, or if there's a way to do it already. I struggled to find anything when searching.
Thanks!☺️
The text was updated successfully, but these errors were encountered: