Minor Adjustments
This commit is contained in:
parent
1084f5d937
commit
f486d50efa
60 changed files with 1965 additions and 127 deletions
38
libold/common/executor/executor-bundler.js
Normal file
38
libold/common/executor/executor-bundler.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { URL } from "node:url";
|
||||
import path from "node:path";
|
||||
import caxa from "caxa";
|
||||
import { rollup } from "rollup";
|
||||
import loadConfigFile from "rollup/loadConfigFile";
|
||||
import { executorLibraryDir, binName, scriptName } from "./executor-config.js";
|
||||
// Fix import
|
||||
const { default: caxaPackage } = caxa;
|
||||
// Rollup Config
|
||||
const rollupConfigPath = path.resolve(executorLibraryDir, "rollup.config.js");
|
||||
|
||||
// Build functions
|
||||
async function packageBin() {
|
||||
console.log("Packaging bundle into binary");
|
||||
return caxaPackage({
|
||||
input: "dist/bundles/",
|
||||
output: `bin/${binName}`,
|
||||
command: ["{{caxa}}/node_modules/.bin/node", `{{caxa}}/${scriptName}`],
|
||||
uncompressionMessage: "Unpacking, please wait...",
|
||||
});
|
||||
}
|
||||
|
||||
async function rollupBundle() {
|
||||
console.log("Rolling up executor into bundle");
|
||||
const { options, warnings } = await loadConfigFile(rollupConfigPath);
|
||||
if (warnings.count !== 0)
|
||||
console.log(`Rollup has ${warnings.count} warnings`);
|
||||
warnings.flush();
|
||||
|
||||
for (const optionsObj of options) {
|
||||
const bundle = await rollup(optionsObj);
|
||||
await Promise.all(optionsObj.output.map(bundle.write));
|
||||
}
|
||||
}
|
||||
|
||||
await rollupBundle();
|
||||
await packageBin();
|
||||
console.log("Done");
|
Loading…
Add table
Add a link
Reference in a new issue