From d4b2995ac95859b190dd0ed19aca646f10ffc0a2 Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Thu, 11 Apr 2024 08:36:11 +0200 Subject: [PATCH] Update docs --- .../docs/src/content/docs/reference/cli.md | 82 ++++++++++--------- .../content/docs/reference/known-issues.md | 4 +- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/packages/docs/src/content/docs/reference/cli.md b/packages/docs/src/content/docs/reference/cli.md index 995087537..2aed23862 100644 --- a/packages/docs/src/content/docs/reference/cli.md +++ b/packages/docs/src/content/docs/reference/cli.md @@ -16,36 +16,32 @@ Shortcut: `-V` Print the version number. -### `--debug` - -Shortcut: `-d` - -Show debug output. +### `--no-progress` -### `--cache` +Shortcut: `-n` -Enable caching. +Don't show dynamic progress updates. Progress is automatically disabled in CI +environments. -Consecutive runs are 10-40% faster as the results of file analysis (AST -traversal) are cached. Conservative. Cache strategy based on file meta data -(modification time + file size). +### `--no-config-hints` -### `--cache-location` +Suppress configuration hints. -Provide alternative cache location. +### `knip-bun` -Default location: `./node_modules/.cache/knip` +Run Knip using the Bun runtime (instead of Node.js). -### `--no-progress` +```shell +knip-bun +``` -Shortcut: `-n` +## Troubleshooting -Don't show dynamic progress updates. Progress is automatically disabled in CI -environments. +### `--debug` -### `--no-config-hints` +Shortcut: `-d` -Suppress configuration hints. +Show debug output. ### `--performance` @@ -77,14 +73,6 @@ This is not yet available in Bun, since it does not support `performance.timerify` ([GitHub issue](https://github.com/oven-sh/bun/issues/9271)). -### `knip-bun` - -Run Knip using the Bun runtime (instead of Node.js). - -```shell -knip-bun -``` - ## Configuration ### `--config [file]` @@ -146,6 +134,21 @@ knip --include-libs Also see [external libs][4]. +### `--isolate-workspaces` + +By default, Knip optimizes performance by adding eligible workspaces to existing +TypeScript programs, based on the compatibility of their `compilerOptions`. Use +this flag to disable this behavior and create one program per workspace. + +You can see the behavior in action in [debug mode][1]. Look for messages like +this: + +```sh +[*] Installed 4 programs for 18 workspaces +... +[*] Analyzing used resolved files [P1/1] (78) +``` + ## Modes ### `--production` @@ -167,24 +170,23 @@ mode][6]. Read more at [Production Mode][5]. -### `--isolate-workspaces` +### `--fix` -By default, Knip optimizes performance by adding eligible workspaces to existing -TypeScript programs, based on the compatibility of their `compilerOptions`. Use -this flag to disable this behavior and create one program per workspace. +Read more at [auto-fix][7]. -You can see the behavior in action in [debug mode][1]. Look for messages like -this: +### `--cache` -```sh -[*] Installed 4 programs for 18 workspaces -... -[*] Analyzing used resolved files [P1/1] (78) -``` +Enable caching. -### `--fix` +Consecutive runs are 10-40% faster as the results of file analysis (AST +traversal) are cached. Conservative. Cache strategy based on file meta data +(modification time + file size). -Read more at [auto-fix][7]. +### `--cache-location` + +Provide alternative cache location. + +Default location: `./node_modules/.cache/knip` ### `--watch` diff --git a/packages/docs/src/content/docs/reference/known-issues.md b/packages/docs/src/content/docs/reference/known-issues.md index 7d23e0550..78637099a 100644 --- a/packages/docs/src/content/docs/reference/known-issues.md +++ b/packages/docs/src/content/docs/reference/known-issues.md @@ -28,7 +28,7 @@ Potential workarounds: - Turn the configuration file from TS into JS (e.g. `vitest.config.ts` → `vitest.config.js`). Knip loads modules directly using native `import()` calls. This is the recommended workaround. -- Use Bun: `bunx --bun knip` (Bun will execute the scripts instead of jiti) +- Use Bun: `knip-bun` (Bun will execute the scripts instead of jiti) - [Disable the plugin][2]. Use `knip --debug` in a monorepo to help locate where the error is coming from. @@ -64,7 +64,7 @@ the configuration file. Unfortunately jiti does not seem to support this. Potential workarounds: - Rewrite the import the configuration to a relative import. -- Use Bun: `bunx --bun knip` (Bun will execute the scripts instead of jiti) +- Use Bun: `knip-bun` (Bun will execute the scripts instead of jiti) ## False positives with external libs