forked from vltpkg/vltpkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknip.ts
More file actions
71 lines (68 loc) · 1.98 KB
/
knip.ts
File metadata and controls
71 lines (68 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import type { KnipConfig } from 'knip'
import { getWorkspaces } from './scripts/utils.ts'
import { relative } from 'node:path'
const entry = [
'src/index.{ts,js,tsx}',
'src/bins/**/*.{ts,js}',
'test/**/*.ts',
'scripts/**/*.{ts,js}',
'benchmarks/**/*.{ts,js}',
]
const workspaces = {
'.': {
entry,
// Used to download fixtures in a bash script
ignoreDependencies: ['@vltpkg/benchmark'],
ignore: ['coverage-map.js'],
},
'src/cli-sdk': {
entry: [...entry, 'src/commands/*.ts'],
},
'src/server': {
entry,
// Used within a resolve-import call
ignoreDependencies: ['@vltpkg/gui'],
},
'src/vsr': {
entry: [...entry, 'src/bin/**/*.ts'],
ignoreDependencies: ['@vltpkg/gui', 'esbuild'],
},
'www/docs': {
entry: [
...entry,
// Referenced via <script> tag
'src/components/sidebar/sidebar-states.ts',
],
// TODO: audit if these really need to be hoisted
ignoreDependencies: ['@astrojs/mdx', 'sharp', 'vite'],
},
'infra/build': {
entry: [...entry, 'src/postinstall.cjs'],
},
}
export default {
// Exclude exports and types because they have false positives
// from tap.mockImport. Run with `knip --include exports,types` to
// include them.
exclude: ['exports', 'types'],
// These dependencies make it possible to run linting and typedoc
// from each individual workspaces but that capability to not
// exercised anywhere yet.
ignoreDependencies: ['@eslint/js', 'typescript-eslint', 'typedoc'],
ignore: [
'**/tap-snapshots/**/*.cjs',
'./infra/cli-benchmarks/fixtures/**',
],
ignoreBinaries: ['hyperfine', 'vlt', 'sleep'],
eslint: ['eslint.config.mjs'],
workspaces: Object.fromEntries(
getWorkspaces().map(ws => {
const key = relative(process.cwd(), ws.dir) || '.'
const workspaceConfig = workspaces as Record<
string,
(typeof workspaces)[keyof typeof workspaces]
>
return [key, workspaceConfig[key] ?? { entry }]
}),
),
} satisfies KnipConfig