Skip to content

Commit

Permalink
Update docs re. shared/isolated workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 9, 2024
1 parent 2c24678 commit 699fd28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
9 changes: 4 additions & 5 deletions packages/docs/src/content/docs/guides/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ Also see [configuring project files][1].

Knip shares files from separate workspaces if the configuration in
`tsconfig.json` allows this. This reduces memory consumption and run duration.
The relevant compiler options are `baseUrl` and `paths`, and a workspace is
shared if the following is true:

- The `compilerOptions.baseUrl` is not set explicitly
- There are no conflicting keys in `compilerOptions.paths`
Relevant compiler options include `baseUrl`, `paths` and `moduleResolution`.

With the `--debug` flag you can see how many programs Knip uses. Look for
messages like this:
Expand All @@ -81,6 +77,9 @@ The first number in `P1/1` is the number of the program, the second number
indicates additional entry files were found in the previous round so it does
another round of analysis on those files.

Use [--isolate-workspaces](../reference/cli.md#--isolate-workspaces) to disable
this behavior.

## findReferences

The `findReferences` function (from the TypeScript Language Service) is invoked
Expand Down
14 changes: 5 additions & 9 deletions packages/docs/src/content/docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,14 @@ Also see [external libs][8].

### `--isolate-workspaces`

By default, Knip optimizes performance by adding eligible workspaces to existing
By default, Knip optimizes performance using
[workspace sharing](../guides/performance.md#workspace-sharing) 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][9]. Look for messages like
this:

```sh
[*] Installed 4 programs for 18 workspaces
...
[*] Analyzing used resolved files [P1/1] (78)
```
Usually this setting isn't necessary, but more of an escape hatch in rare cases
with memory usage issues or incompatible `compilerOptions` across workspaces.
Also useful during troubleshooting.

## Modes

Expand Down

0 comments on commit 699fd28

Please sign in to comment.