-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathtsup.config.ts
More file actions
39 lines (36 loc) · 1.14 KB
/
tsup.config.ts
File metadata and controls
39 lines (36 loc) · 1.14 KB
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
import { defineConfig } from "tsup";
import { globSync } from "glob";
// Get all TypeScript Schema files under generated folder (exclude .d.ts files)
const generatedFiles = globSync("typescript/generated/**/*.ts");
// Create entry points for each generated file
const generatedEntries = generatedFiles.reduce(
(acc, file) => {
// Convert path like "typescript/generated/v1beta1/model/ModelSchema.ts"
// to entry name like "generated/v1beta1/model/ModelSchema"
const entryName = file
.replace("typescript/", "")
.replace("generated", "constructs")
.replace(/\.ts$/, "");
acc[entryName] = file;
return acc;
},
{} as Record<string, string>,
);
export default defineConfig({
entry: {
index: "typescript/index.ts",
cloudApi: "typescript/rtk/cloud.ts",
mesheryApi: "typescript/rtk/meshery.ts",
api: "typescript/rtk/api.ts",
permissions: "typescript/permissions.ts",
...generatedEntries,
},
format: ["cjs", "esm"],
external: ["react", "react-dom", "react-redux", "@reduxjs/toolkit"],
dts: true,
splitting: false,
sourcemap: false,
treeshake: true,
minify: true,
clean: true,
});