-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.mjs
More file actions
27 lines (22 loc) · 819 Bytes
/
esbuild.mjs
File metadata and controls
27 lines (22 loc) · 819 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
import fs from "fs";
import { build } from "esbuild";
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
const external = [...Object.keys(packageJson.dependencies || {}), ...Object.keys(packageJson.peerDependencies || {})];
// CLI and Node.js builds - run in Node.js
const nodeBuildOptions = {
bundle: true,
sourcemap: false,
platform: "node",
minify: true,
metafile: false,
keepNames: true,
external,
target: "node14",
logLevel: "info",
define: {
"process.env.OPENAPI_CODEGEN_VERSION": `"${packageJson.version}"`,
"process.env.NODE_ENV": `"production"`,
},
};
await build({ ...nodeBuildOptions, entryPoints: ["./src/sh.ts"], outfile: "./dist/sh.js" });
await build({ ...nodeBuildOptions, entryPoints: ["./src/generator.ts"], outfile: "./dist/generator.js" });