Closed sparten11740 closed 1 month ago
How about using a dynamic config: https://knip.dev/reference/dynamic-configuration?
thanks for pointing that out. I went with dynamically populating the workspaces
object with the defaults I need based on the available workspaces. Feel free to close this issue if you don't think it would be a useful addition
Great!
The dynamic option is meant for such use cases and to keep Knip itself simpler (the behavior might also even surprise users in some cases), so I'm going to close this one.
Suggest an idea for this project
A workspace's configuration currently defaults to a static pattern of files if no explicit workspace configuration is provided:
https://github.com/webpro-nl/knip/blob/617a06a173e5cdcbd2798e442d97344e48523f42/packages/knip/src/ConfigurationChief.ts#L38-L39
In a monorepo it is a likely scenario to have different entry patterns than above, which currently have to be specified as a separate configuration for each workspace following that pattern, which is quite tedious.
I have a concrete case where I need
redux/index.[jt]s
as an additional entry point. Specifying it inpackage.json
'sexports
of each package is currently not an option for us as it constitutes a breaking change (unless everything else contained in the package is also explicitly exported, which we also don't want)Inheriting the root config's
entry
as default and only if that's not defined use the current static default (arguably breaking) or a different way of explicitly specifying a defaultentry
for workspaces (and potentially other options) would be great.