Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Apr 11, 2024
1 parent 7bea7a2 commit 3debfba
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
82 changes: 42 additions & 40 deletions packages/docs/src/content/docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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]`
Expand Down Expand Up @@ -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`
Expand All @@ -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`

Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/content/docs/reference/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 3debfba

Please sign in to comment.