-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
51 lines (48 loc) · 1.07 KB
/
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
44
45
46
47
48
49
50
51
import * as fs from "fs/promises";
import { globby } from "globby";
import pMap from "p-map";
import type { Options } from "tsup";
import { defineConfig } from "tsup";
import { version } from "./package.json";
const defaultOptions: Options = {
cjsInterop: true,
clean: true,
dts: true,
env: {
WADESTA_VERSION: version,
},
format: ["cjs"],
minify: true,
shims: true,
splitting: true,
treeshake: true,
tsconfig: "./tsconfig.build.json",
};
export default defineConfig(async () => {
const filesToForceClean = await globby(["dist/*", "stubs/*"], { onlyFiles: true });
await pMap(filesToForceClean, (file) => fs.unlink(file).catch(() => void 0));
return [
// main entrypoints
{
...defaultOptions,
entry: [
"src/cli.ts",
"src/events.ts",
"src/index.ts",
//
],
},
// precompiled stubs
{
...defaultOptions,
entry: ["src/stubs/*.ts"],
outDir: "stubs",
},
// wadesta bin script
{
...defaultOptions,
entry: ["src/bin.ts"],
dts: false,
},
];
});