-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
34 lines (31 loc) · 820 Bytes
/
tsup.config.ts
File metadata and controls
34 lines (31 loc) · 820 Bytes
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
import {defineConfig} from "tsup";
//@ts-expect-error missing types for bestzip
import bestzip from "bestzip";
import config from "./package.json";
import * as fs from "fs"
const outDir = "app"
export default defineConfig({
entry: ["src/index.ts"],
minify: true,
format: ["esm"],
splitting: false,
outDir: "app",
sourcemap: false,
clean: true,
platform: "node",
target: "esnext",
noExternal: [/(.*)/],
onSuccess: async () => {
if (fs.existsSync("./bundle")) {
fs.rmdirSync("./bundle", {recursive: true});
}
fs.mkdirSync("./bundle")
console.info("Packaging app...");
const name = `${config.name}-${config.version}.zip`;
await bestzip({
source: [`./${outDir}/*`, `./.env.example`],
destination: `./bundle/${name}`
});
console.info(`Done!`)
}
})