-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
143 lines (136 loc) · 4.35 KB
/
Copy pathvite.config.ts
File metadata and controls
143 lines (136 loc) · 4.35 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite-plus';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf8')) as {
version: string;
};
const sourceOnlyIgnorePatterns = ['**/*', '!src', '!src/**'];
export default defineConfig({
staged: {
'*': 'vp check --fix',
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
test: {
globals: true,
environment: 'node',
// Arm Node's diagnostic report on the forks workers so a fatal/uncaught
// crash writes report.*.json (dumped by .github/workflows/ci.yml on
// failure). No overhead on a clean run. Mirrors cdk-local.
pool: 'forks',
poolOptions: {
forks: {
execArgv: ['--report-on-fatalerror', '--report-uncaught-exception'],
},
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/**',
'dist/**',
'**/*.config.ts',
'**/*.d.ts',
'tests/**',
'vite.config.ts',
],
},
include: ['tests/**/*.test.ts', 'src/**/*.test.ts'],
exclude: ['node_modules', 'dist', 'tests/integration/**'],
},
lint: {
env: {
node: true,
es2022: true,
vitest: true,
},
plugins: ['typescript', 'promise', 'vitest', 'eslint'],
ignorePatterns: [...sourceOnlyIgnorePatterns, '!tests', '!tests/**', 'tests/integration/**'],
options: {
typeAware: true,
typeCheck: true,
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'no-console': 'off',
},
},
fmt: {
semi: true,
trailingComma: 'es5',
singleQuote: true,
printWidth: 100,
tabWidth: 2,
useTabs: false,
arrowParens: 'always',
endOfLine: 'lf',
sortPackageJson: false,
// CHANGELOG.md is machine-generated by @semantic-release/changelog on every
// release and committed verbatim (see .releaserc.json); its markdown is not
// prettier-clean (extra blank lines around headings), so formatting it would
// make `vp run check` in CI fail on the release commit's output. Exclude it —
// cdk-local/cdkd achieve the same by scoping fmt to src only.
ignorePatterns: ['tests/integration/**', 'CHANGELOG.md'],
},
pack: {
entry: {
cli: 'src/cli.ts',
},
outDir: 'dist',
platform: 'node',
target: 'node20',
format: 'esm',
fixedExtension: false,
dts: false,
sourcemap: true,
minify: false,
define: {
__CDKRD_VERSION__: JSON.stringify(pkg.version),
},
deps: {
neverBundle: [/^@aws-sdk\//, 'yaml'],
},
},
run: {
cache: {
tasks: true,
},
tasks: {
build: { command: 'vp pack', cache: false },
dev: { command: 'vp pack --watch', cache: false },
check: { command: 'vp check' },
test: { command: 'vp test run' },
'test:watch': { command: 'vp test watch', cache: false },
'test:coverage': { command: 'vp test run --coverage', cache: false },
lint: { command: 'vp lint' },
'lint:fix': { command: 'vp lint --fix', cache: false },
format: { command: 'vp fmt', cache: false },
'format:check': { command: 'vp fmt --check' },
// cache:false — the run-task cache can REPLAY a stale pass even though the
// current tree has a real type error, masking it. This bit us live: PR #438
// introduced a duplicate object-literal key (tsgo TS1117) that `vp run
// typecheck` reported GREEN from cache, so the gate marker was set on a red
// tree and the break reached main. Typecheck is ~1s; correctness > the cache.
typecheck: { command: 'tsc --project tsconfig.json --noEmit', cache: false },
verify: { command: 'vp run check && vp run test && vp run build' },
'runtime:smoke': {
command: 'node dist/cli.js --version',
dependsOn: ['build'],
cache: false,
},
},
},
});