designsystemet icon indicating copy to clipboard operation
designsystemet copied to clipboard

feat(tool): 🔧 Knip tool to find unused files

Open poi33 opened this issue 1 year ago • 3 comments

Part of https://github.com/digdir/designsystemet/issues/1502

poi33 avatar May 07 '24 11:05 poi33

A proof of concept for adding Knip.

knip: Runs knip in all workspaces defined in package.json knip:storybook: Does not find any unused files 😄 knip:react: Note:🗒️ The package.json sets it index to the /dist so Knip thinks dist is the folder to check for unused files. Should add custom config for this package to fix it. knip:storefront: Finds some interesting files that might not be used

poi33 avatar May 07 '24 11:05 poi33

I haven't look to closely on this but is it not possible to use this with just npx and some cli commands? I see there is some configuration to get it working 🤔

mimarz avatar May 13 '24 06:05 mimarz

I haven't look to closely on this but is it not possible to use this with just npx and some cli commands? I see there is some configuration to get it working 🤔

Yes, most of the configuration is just to make it simpler to use for a monorepo.

The package.json in each repo would have to be correct in either case or a separate config file created. (The packages/react folder needs a separate config file, the current entry file points to dist/ files).

poi33 avatar May 13 '24 12:05 poi33

hmm, I think we'll save this for later as we still have a lot of code lying around that might or might not be used again. Things are still in flux before V1. Ideally I would like for a tool to not be installed as a dependency also 🤔

mimarz avatar May 21 '24 11:05 mimarz

Yeah, I agree. Hopefully we can make it into a single command that does the installation so we have less dependencies. But currently I don't see a way to avoid the setup file.

poi33 avatar May 21 '24 13:05 poi33

Closing the pull request for when you want to look at this again another time.

poi33 avatar May 21 '24 13:05 poi33

Closing the pull request for when you want to look at this again another time.

Thanks for taking the time to investigate this for us! <3

mimarz avatar May 21 '24 19:05 mimarz