-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathtsup.config.ts
37 lines (31 loc) · 970 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
import type { Options } from 'tsup';
import { defineConfig } from 'tsup';
import { runAfterLast } from '../../scripts/utils';
import { name, version } from './package.json';
export default defineConfig(overrideOptions => {
const isWatch = !!overrideOptions.watch;
const shouldPublish = !!overrideOptions.env?.publish;
const common: Options = {
entry: ['src/index.ts', 'src/errors.ts', 'src/internal.ts', 'src/jwt/index.ts'],
onSuccess: `cpy 'src/runtime/**/*.{mjs,js,cjs}' dist/runtime`,
sourcemap: true,
define: {
PACKAGE_NAME: `"${name}"`,
PACKAGE_VERSION: `"${version}"`,
__DEV__: `${isWatch}`,
},
external: ['#crypto'],
bundle: true,
clean: true,
minify: false,
};
const esm: Options = {
...common,
format: 'esm',
};
const cjs: Options = {
...common,
format: 'cjs',
};
return runAfterLast(['pnpm build:declarations', shouldPublish && 'pnpm publish:local'])(esm, cjs);
});