-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.config.ts
More file actions
57 lines (55 loc) · 1.43 KB
/
Copy pathvite.config.ts
File metadata and controls
57 lines (55 loc) · 1.43 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
/// <reference types="vitest/config" />
import { renameSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
const __dirname = dirname(fileURLToPath(import.meta.url))
export default defineConfig({
build: {
lib: {
entry: {
'.': resolve(__dirname, 'src/v3/index.ts'),
v3: resolve(__dirname, 'src/v3/index.ts'),
v4: resolve(__dirname, 'src/v4/index.ts'),
},
fileName: 'zod-schema-faker',
},
rollupOptions: {
external: ['zod/v3', 'zod/v4/core', '@faker-js/faker', 'randexp'],
output: [
{
format: 'es',
entryFileNames: '[name]/zod-schema-faker.es.js',
},
{
format: 'cjs',
entryFileNames: '[name]/zod-schema-faker.cjs',
},
],
},
},
plugins: [
dts({
rollupTypes: true,
afterBuild() {
const map = {
'dist/..d.ts': 'dist/zod-schema-faker.d.ts',
'dist/v3.d.ts': 'dist/v3/zod-schema-faker.d.ts',
'dist/v4.d.ts': 'dist/v4/zod-schema-faker.d.ts',
}
for (const [key, value] of Object.entries(map)) {
renameSync(resolve(__dirname, key), resolve(__dirname, value))
}
},
}),
],
test: {
coverage: {
include: ['src/**/*'],
thresholds: {
'100': true,
},
},
},
})