-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtsup.config.ts
More file actions
37 lines (36 loc) · 889 Bytes
/
tsup.config.ts
File metadata and controls
37 lines (36 loc) · 889 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
35
36
37
import { defineConfig } from "tsup";
import { existsSync, mkdirSync, copyFileSync } from "fs";
export default defineConfig([
{
entry: ["src/index.ts"],
format: ["esm"],
target: "node20",
clean: true,
banner: {
js: "#!/usr/bin/env node",
},
onSuccess: async () => {
mkdirSync("dist/data", { recursive: true });
const dataToCopy = [
"mvd-geocoder-data.json",
"stm-paradas.json",
"stm-horarios.json",
"stm-lineas.json",
];
for (const file of dataToCopy) {
const src = `src/data/${file}`;
const dest = `dist/data/${file}`;
if (existsSync(src)) {
copyFileSync(src, dest);
console.log(`Copied ${src} → ${dest}`);
}
}
},
},
{
entry: ["src/api/index.ts"],
format: ["esm"],
target: "node20",
outDir: "dist/api",
},
]);