Repository navigation
Expand file tree
/
Copy pathknip.ts
More file actions
69 lines (62 loc) · 1.8 KB
/
Copy pathknip.ts
File metadata and controls
69 lines (62 loc) · 1.8 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
import type { KnipConfig } from 'knip';
// @ts-ignore
const isProductionMode = process.argv.includes('--production');
const productionEntryPoints = [
'src/router.tsx',
'src/providers.tsx',
'src/routes/**/*.{ts,tsx}',
'src/env/*.ts',
'prisma/seed/*.ts',
'src/features/build-info/script-to-generate-json.ts',
];
const testingEntryPoints = [
'src/**/*.unit.{test,spec}.?(c|m)[jt]s?(x)',
'src/**/*.browser.{test,spec}.?(c|m)[jt]s?(x)',
];
const storybookEntryPoints = ['src/**/*.stories.{ts,tsx}'];
const e2eEntryPoints = ['e2e/**/*.spec.ts', 'e2e/setup/**/*.ts'];
const config: KnipConfig = {
entry: [
...productionEntryPoints.map((entry) => `${entry}!`),
...testingEntryPoints,
...storybookEntryPoints,
...e2eEntryPoints,
],
project: [
'src/**/*.{ts,tsx}',
'prisma/**/*.ts',
'e2e/**/*.ts',
// Exclude test helpers from production analysis
'!src/**/*{t,T}estUtils*.{ts,tsx}!',
],
// In production mode, ignore exports only used within the same file
ignoreExportsUsedInFile: isProductionMode,
ignore: [
'src/components/ui/**', // shadcn components — kept as a library, not all parts are used
],
paths: {
'e2e/*': ['./e2e/*'],
},
ignoreDependencies: [
'resize-observer-polyfill', // used in test setup
'tailwindcss', // used via CSS @import
'tw-animate-css', // used via CSS @import
// semantic-release plugins loaded via .releaserc
'@semantic-release/commit-analyzer',
'@semantic-release/github',
'@semantic-release/release-notes-generator',
],
storybook: {
config: ['.storybook/main.ts'],
entry: storybookEntryPoints,
},
playwright: {
config: ['playwright.config.ts'],
entry: e2eEntryPoints,
},
vitest: {
config: ['vitest.config.ts'],
entry: testingEntryPoints,
},
};
export default config;