forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsup.config.ts
53 lines (46 loc) · 1.15 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
52
53
import * as fsp from "fs/promises";
import { defineConfig } from "tsup";
// @ts-ignore - out of scope
import { createBanner } from "../../build.utils.js";
import pkg from "./package.json";
const entry = [
"cli/index.ts",
"config.ts",
"routes.ts",
"vite.ts",
"vite/cloudflare.ts",
];
const external = ["./static/refresh-utils.cjs", /\.json$/];
export default defineConfig([
{
clean: true,
entry,
format: ["cjs"],
outDir: "dist",
dts: true,
external,
banner: {
js: createBanner(pkg.name, pkg.version),
},
plugins: [
{
name: "copy",
async buildEnd() {
await fsp.mkdir("dist/static", { recursive: true });
await fsp.copyFile(
"vite/static/refresh-utils.cjs",
"dist/static/refresh-utils.cjs"
);
await fsp.mkdir("dist/config/defaults", { recursive: true });
const files = await fsp.readdir("config/defaults");
for (const file of files) {
await fsp.copyFile(
`config/defaults/${file}`,
`dist/config/defaults/${file}`
);
}
},
},
],
},
]);