54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
|
#!/usr/bin/node
|
||
|
import esbuild from "esbuild";
|
||
|
import { commonOpts, gitHashPlugin, globPlugins, makeAllPackagesExternalPlugin } from "./common.mjs";
|
||
|
|
||
|
/**
|
||
|
* @type {esbuild.BuildOptions}
|
||
|
*/
|
||
|
const nodeCommonOpts = {
|
||
|
...commonOpts,
|
||
|
format: "cjs",
|
||
|
platform: "node",
|
||
|
target: ["esnext"],
|
||
|
sourcemap: "linked",
|
||
|
plugins: [makeAllPackagesExternalPlugin],
|
||
|
};
|
||
|
|
||
|
await Promise.all([
|
||
|
esbuild.build({
|
||
|
...nodeCommonOpts,
|
||
|
entryPoints: ["src/preload.ts"],
|
||
|
outfile: "dist/preload.js",
|
||
|
}),
|
||
|
esbuild.build({
|
||
|
...nodeCommonOpts,
|
||
|
entryPoints: ["src/patcher.ts"],
|
||
|
outfile: "dist/patcher.js",
|
||
|
}),
|
||
|
esbuild.build({
|
||
|
...commonOpts,
|
||
|
entryPoints: ["src/Vencord.ts"],
|
||
|
outfile: "dist/renderer.js",
|
||
|
format: "iife",
|
||
|
target: ["esnext"],
|
||
|
footer: { js: "//# sourceURL=VencordRenderer" },
|
||
|
globalName: "Vencord",
|
||
|
external: ["plugins", "git-hash"],
|
||
|
plugins: [
|
||
|
globPlugins,
|
||
|
gitHashPlugin
|
||
|
],
|
||
|
sourcemap: "inline",
|
||
|
minify: true,
|
||
|
define: {
|
||
|
IS_WEB: "false"
|
||
|
}
|
||
|
}),
|
||
|
]).catch(err => {
|
||
|
console.error("Build failed");
|
||
|
console.error(err.message);
|
||
|
// make ci fail
|
||
|
if (!watch)
|
||
|
process.exitCode = 1;
|
||
|
});
|