๐ก Configurable workspace config defaults
Closed this issue ยท 3 comments
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:
knip/packages/knip/src/ConfigurationChief.ts
Lines 38 to 39 in 617a06a
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 in package.json
's exports
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 default entry
for workspaces (and potentially other options) would be great.
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.