Migration to v1
2023-01-04
When coming from version v0.13.3 or before, there are some breaking changes:
- The
entryFilesandprojectFilesoptions have been renamed toentryandproject. - The
--devargument anddev: trueoption are gone, this is now the default mode (see production mode). - Workspaces have been moved from the root of the config to the
workspaceskey (see workspaces). - The
--dirargument has been renamed to--workspace.
Example
Section titled “Example”A configuration like this in v0.13.3 or before…
{ "entryFiles": ["src/index.ts"], "projectFiles": ["src/**/*.ts", "!**/*.spec.ts"], "dev": { "entryFiles": ["src/index.ts", "src/**/*.spec.ts", "src/**/*.e2e.ts"], "projectFiles": ["src/**/*.ts"] }}…should become this for v1…
{ "entry": ["src/index.ts!"], "project": ["src/**/*.ts!"]}Much cleaner, right? For some more details:
- The
devproperty for the--devflag is now the default mode. - Use
--productionto analyze only theentryandprojectfiles suffixed with!. - The glob patterns for both types of test files (
*.spec.tsand*.e2e.ts) are no longer needed:- Regular test files like
*.test.jsand*.spec.tsetc. are automatically handled by Knip. - The
*.e2e.tsfiles is configured with the Cypress or other plugin. Note that Cypress uses*.cy.tsfor spec files, but this could be overridden like so:
- Regular test files like
{ "entry": "src/index.ts!", "project": "src/**/*.ts!", "cypress": { "entry": "src/**/*.e2e.ts" }}ISC License © 2024 Lars Kappert