Skip to content

Commit 8f419a0

Browse files
committed
docs(plugin-typescript): document multiple tsconfigs and Nx helper
1 parent 09359f0 commit 8f419a0

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

packages/plugin-typescript/README.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,49 @@ Each set is also available as group in the plugin. See more under [Audits and Gr
8484

8585
The plugin accepts the following parameters:
8686

87-
| Option | Type | Default | Description |
88-
| ---------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
89-
| tsconfig | string | `tsconfig.json` | A string that defines the path to your `tsconfig.json` file |
90-
| onlyAudits | string[] | undefined | An array of audit slugs to specify which documentation types you want to measure. Only the specified audits will be included in the results |
87+
| Option | Type | Default | Description |
88+
| ---------- | ------------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
89+
| tsconfig | string \| string[] | `tsconfig.json` | Path(s) to your `tsconfig.json` file(s) |
90+
| onlyAudits | string[] | undefined | An array of audit slugs to specify which documentation types you want to measure. Only the specified audits will be included in the results |
9191

9292
#### `tsconfig`
9393

94-
Optional parameter. The `tsconfig` option accepts a string that defines the path to your config file and defaults to `tsconfig.json`.
94+
Optional parameter. The `tsconfig` option accepts a path or an array of paths to your config files. Defaults to `tsconfig.json`.
9595

9696
```js
9797
typescriptPlugin({
9898
tsconfig: './tsconfig.json',
9999
});
100100
```
101101

102+
You can also provide multiple tsconfigs to combine results from different configurations (e.g., separate configs for source and test files):
103+
104+
```js
105+
typescriptPlugin({
106+
tsconfig: ['./tsconfig.lib.json', './tsconfig.spec.json'],
107+
});
108+
```
109+
110+
If you're using an Nx monorepo, a helper function is provided to auto-discover tsconfigs from all projects:
111+
112+
```js
113+
import typescriptPlugin, { tsconfigFromAllNxProjects } from '@code-pushup/typescript-plugin';
114+
115+
export default {
116+
plugins: [
117+
await typescriptPlugin({
118+
tsconfig: await tsconfigFromAllNxProjects(),
119+
}),
120+
],
121+
};
122+
```
123+
124+
You can exclude specific projects by name:
125+
126+
```js
127+
await tsconfigFromAllNxProjects({ exclude: ['my-app-e2e'] });
128+
```
129+
102130
#### `onlyAudits`
103131

104132
The `onlyAudits` option allows you to specify which documentation types you want to measure. Only the specified audits will be included in the results. All audits are included by default. Example:

0 commit comments

Comments
 (0)