waforth/build-package.js

32 lines
762 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
/* eslint-env node */
2022-07-06 19:33:18 +02:00
/* eslint @typescript-eslint/no-var-requires:0 */
const esbuild = require("esbuild");
const path = require("path");
const { execSync } = require("child_process");
const { wasmTextPlugin } = require("./scripts/esbuild/wasm-text");
let buildConfig = {
bundle: true,
logLevel: "info",
entryPoints: [path.join(__dirname, "src", "web", "waforth")],
outfile: path.join(__dirname, "dist", "index.js"),
minify: true,
format: "cjs",
loader: {
".wasm": "binary",
},
sourcemap: true,
2022-05-05 22:20:46 +02:00
plugins: [wasmTextPlugin({ debug: true })],
};
esbuild.build(buildConfig).then(
() => {
execSync(
"node node_modules/typescript/bin/tsc --project tsconfig.package.json"
);
},
() => process.exit(1)
);