@cleeviox/knip 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -24
- package/dist/define-config.d.ts +2 -0
- package/dist/define-config.js +10 -0
- package/dist/define-config.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/monorepo-root/index.d.ts +1 -0
- package/dist/monorepo-root/index.js +2 -0
- package/dist/monorepo-root/index.js.map +1 -0
- package/dist/{monorepo-root.d.ts → monorepo-root/monorepo-root.d.ts} +1 -1
- package/dist/{monorepo-root.js → monorepo-root/monorepo-root.js} +3 -3
- package/dist/monorepo-root/monorepo-root.js.map +1 -0
- package/dist/nextjs/index.d.ts +1 -0
- package/dist/nextjs/index.js +2 -0
- package/dist/nextjs/index.js.map +1 -0
- package/dist/{nextjs.d.ts → nextjs/nextjs.d.ts} +1 -1
- package/dist/{nextjs.js → nextjs/nextjs.js} +1 -1
- package/dist/nextjs/nextjs.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +6 -2
- package/dist/monorepo-root.js.map +0 -1
- package/dist/nextjs.js.map +0 -1
package/README.md
CHANGED
|
@@ -20,41 +20,51 @@ bun add --dev @cleeviox/knip knip
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
All configurations are created with `defineConfig(base, overrides?)`. It performs a shallow merge of the base and overrides, while **appending** the `ignore`, `ignoreDependencies`, and `project` arrays rather than overwriting them.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
### Monorepo Root
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @filename: knip.ts
|
|
33
|
-
*/
|
|
34
|
-
export default {
|
|
35
|
-
...monorepoRootConfig,
|
|
36
|
-
} satisfies KnipConfig;
|
|
28
|
+
import { defineConfig, baseMonorepoRootConfig } from '@cleeviox/knip';
|
|
29
|
+
|
|
30
|
+
export default defineConfig(baseMonorepoRootConfig);
|
|
37
31
|
```
|
|
38
32
|
|
|
39
33
|
### Next.js Projects
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
```ts
|
|
36
|
+
import { defineConfig, baseNextjsConfig } from '@cleeviox/knip';
|
|
37
|
+
|
|
38
|
+
export default defineConfig(baseNextjsConfig);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To extend a base config, pass overrides as the second argument:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
import { defineConfig, baseNextjsConfig } from '@cleeviox/knip';
|
|
45
|
+
|
|
46
|
+
export default defineConfig(baseNextjsConfig, {
|
|
47
|
+
ignoreDependencies: ['my-extra-dep'],
|
|
48
|
+
ignore: ['src/generated/**'],
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You can also compose a fully custom config without a base:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { defineConfig } from '@cleeviox/knip';
|
|
56
|
+
|
|
57
|
+
export default defineConfig({
|
|
58
|
+
project: ['src/**/*.ts'],
|
|
59
|
+
ignoreDependencies: ['some-dep'],
|
|
60
|
+
});
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
## Available
|
|
63
|
+
## Available Exports
|
|
56
64
|
|
|
57
65
|
| Export | Description |
|
|
58
66
|
|--------|-------------|
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
67
|
+
| `defineConfig` | Factory function — merges a base config with optional overrides, appending array fields |
|
|
68
|
+
| `baseNextjsConfig` | Base config for Next.js projects |
|
|
69
|
+
| `baseMonorepoRootConfig` | Base config for monorepo roots with workspace support |
|
|
70
|
+
| `KnipConfigObject` | TypeScript type for a knip configuration object |
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function defineConfig(base, overrides) {
|
|
2
|
+
return {
|
|
3
|
+
...base,
|
|
4
|
+
...overrides,
|
|
5
|
+
ignore: [...(base.ignore ?? []), ...(overrides?.ignore ?? [])],
|
|
6
|
+
ignoreDependencies: [...(base.ignoreDependencies ?? []), ...(overrides?.ignoreDependencies ?? [])],
|
|
7
|
+
project: [...(base.project ?? []), ...(overrides?.project ?? [])],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=define-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-config.js","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,IAAsB,EAAE,SAA4B;IAC/E,OAAO;QACL,GAAG,IAAI;QACP,GAAG,SAAS;QACZ,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;QAC9D,kBAAkB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC;QAClG,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;KAClE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { defineConfig } from './define-config.js';
|
|
2
|
+
export { baseMonorepoRootConfig } from './monorepo-root/index.js';
|
|
3
|
+
export { baseNextjsConfig } from './nextjs/index.js';
|
|
4
|
+
export type { KnipConfigObject } from './types/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { defineConfig } from './define-config.js';
|
|
2
|
+
export { baseMonorepoRootConfig } from './monorepo-root/index.js';
|
|
3
|
+
export { baseNextjsConfig } from './nextjs/index.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { baseMonorepoRootConfig } from './monorepo-root.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/monorepo-root/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const baseMonorepoRootConfig = {
|
|
2
2
|
workspaces: {
|
|
3
3
|
'.': {
|
|
4
4
|
entry: 'scripts/*.js',
|
|
5
5
|
project: 'scripts/**/*.js',
|
|
6
6
|
},
|
|
7
7
|
'packages/*': {
|
|
8
|
-
entry: '{index,cli}.ts',
|
|
9
|
-
project: '
|
|
8
|
+
entry: 'src/{index,cli}.ts',
|
|
9
|
+
project: 'src/*.{ts,tsx}',
|
|
10
10
|
},
|
|
11
11
|
},
|
|
12
12
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monorepo-root.js","sourceRoot":"","sources":["../../src/monorepo-root/monorepo-root.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE;QACV,GAAG,EAAE;YACH,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,iBAAiB;SAC3B;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE,gBAAgB;SAC1B;KACF;CACyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { baseNextjsConfig } from './nextjs.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nextjs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs.js","sourceRoot":"","sources":["../../src/nextjs/nextjs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,CAAC,gCAAgC,CAAC;IAC1C,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,CAAC;IAC5F,uBAAuB,EAAE,IAAI;IAC7B,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,sBAAsB,CAAC;KAC1G;IACD,OAAO,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
},
|
|
5
5
|
"description": "Knip configuration used on CleevioX projects",
|
|
6
6
|
"devDependencies": {
|
|
7
|
+
"@types/bun": "^1.3.9",
|
|
7
8
|
"knip": "^5.85.0"
|
|
8
9
|
},
|
|
9
10
|
"exports": {
|
|
@@ -33,16 +34,19 @@
|
|
|
33
34
|
"scripts": {
|
|
34
35
|
"build": "tsc --build tsconfig.build.json",
|
|
35
36
|
"check": "biome check --write .",
|
|
36
|
-
"clean": "del .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo dist node_modules",
|
|
37
|
+
"clean": "del .turbo tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo dist coverage node_modules",
|
|
37
38
|
"fix": "run-s biome:check:fix ts",
|
|
38
39
|
"format": "biome format .",
|
|
39
40
|
"format:fix": "biome format --write .",
|
|
40
41
|
"lint": "biome lint .",
|
|
41
42
|
"lint:fix": "biome lint --write .",
|
|
42
43
|
"prebuild": "del dist tsconfig.build.tsbuildinfo",
|
|
44
|
+
"test": "bun test",
|
|
45
|
+
"test:cov": "bun test --coverage --coverage-reporter=lcov",
|
|
46
|
+
"test:watch": "bun test --watch",
|
|
43
47
|
"ts": "tsc --build tsconfig.json"
|
|
44
48
|
},
|
|
45
49
|
"sideEffects": false,
|
|
46
50
|
"type": "module",
|
|
47
|
-
"version": "0.1.
|
|
51
|
+
"version": "0.1.2"
|
|
48
52
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"monorepo-root.js","sourceRoot":"","sources":["../src/monorepo-root.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,UAAU,EAAE;QACV,GAAG,EAAE;YACH,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,iBAAiB;SAC3B;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,SAAS;SACnB;KACF;CACmB,CAAC"}
|
package/dist/nextjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs.js","sourceRoot":"","sources":["../src/nextjs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,CAAC,gCAAgC,CAAC;IAC1C,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,CAAC;IAC5F,uBAAuB,EAAE,IAAI;IAC7B,IAAI,EAAE;QACJ,KAAK,EAAE,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,sBAAsB,CAAC;KAC1G;IACD,OAAO,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;CACjC,CAAC"}
|