34 lines
928 B
JavaScript
34 lines
928 B
JavaScript
import { build } from "esbuild";
|
|
import { copyFile } from "node:fs/promises";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
await build({
|
|
entryPoints: ["src/main.ts"],
|
|
bundle: true,
|
|
platform: "node",
|
|
format: "esm",
|
|
external: ["electron"],
|
|
outfile: "dist/main.js",
|
|
banner: {
|
|
js: [
|
|
'import { createRequire as __mdToPdfCreateRequire } from "node:module";',
|
|
'import { dirname as __mdToPdfDirname } from "node:path";',
|
|
'import { fileURLToPath as __mdToPdfFileURLToPath } from "node:url";',
|
|
"const require = __mdToPdfCreateRequire(import.meta.url);",
|
|
"const __dirname = __mdToPdfDirname(__mdToPdfFileURLToPath(import.meta.url));"
|
|
].join("\n")
|
|
}
|
|
});
|
|
|
|
await copyFile(
|
|
fileURLToPath(
|
|
new URL(
|
|
"../../../packages/docx-engine/assets/docx-media-filter.lua",
|
|
import.meta.url
|
|
)
|
|
),
|
|
fileURLToPath(
|
|
new URL("../dist/docx-media-filter.lua", import.meta.url)
|
|
)
|
|
);
|