-
Notifications
You must be signed in to change notification settings - Fork 1
/
tsup.config.ts
43 lines (42 loc) · 975 Bytes
/
tsup.config.ts
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
import { defineConfig } from 'tsup';
import { tsupConfig } from './src/tsup';
import { rename, writeFile, rm } from 'node:fs/promises';
export default defineConfig({
...tsupConfig,
entry: {
index: './src/index.ts',
'.eslintrc': './src/eslint.ts',
},
dts: {
entry: {
index: './src/index.ts',
},
},
format: 'cjs',
tsconfig: 'tsconfig.json',
plugins: [
...(tsupConfig.plugins ?? []),
{
name: 'tsconfig',
buildEnd: async () => {
const { default: tsconfig } = await import('./src/tsconfig');
await writeFile(
'./dist/tsconfig.json',
JSON.stringify(tsconfig, null, 2),
);
},
},
{
name: 'eslint',
buildEnd: async () => {
await Promise.all([
rename('./dist/.eslintrc.js', '.eslintrc.js'),
rm('./dist/.eslintrc.js.map', {
force: true,
recursive: true,
}),
]);
},
},
],
});