2019-01-15 21:36:09 +03:00
|
|
|
const fs = require("fs");
|
|
|
|
const os = require("os");
|
|
|
|
const path = require("path");
|
|
|
|
const nexe = require("nexe");
|
|
|
|
|
|
|
|
const nexeRoot = path.join(os.homedir(), ".nexe");
|
|
|
|
if (!fs.existsSync(nexeRoot)) {
|
|
|
|
throw new Error("run nexe manually on a binary to initialize it");
|
|
|
|
}
|
|
|
|
const listed = fs.readdirSync(nexeRoot);
|
|
|
|
listed.forEach((list) => {
|
|
|
|
if (list.startsWith("linux")) {
|
|
|
|
const stat = fs.statSync(path.join(nexeRoot, list));
|
|
|
|
if (stat.isFile()) {
|
|
|
|
if (stat.size > 20000000) {
|
|
|
|
throw new Error("must use upx to shrink node binary in ~/.nexe/" + list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
nexe.compile({
|
|
|
|
debugBundle: true,
|
|
|
|
input: path.join(__dirname, "../out/cli.js"),
|
|
|
|
output: 'cli',
|
|
|
|
native: {
|
|
|
|
"node-pty": {
|
|
|
|
additionalFiles: [
|
|
|
|
'./node_modules/node-pty/build/Release/pty',
|
|
|
|
],
|
2019-01-19 00:46:40 +03:00
|
|
|
},
|
|
|
|
"spdlog": {
|
|
|
|
additionalFiles: [
|
|
|
|
'spdlog.node',
|
|
|
|
],
|
|
|
|
},
|
2019-01-15 21:36:09 +03:00
|
|
|
},
|
|
|
|
targets: ["linux"],
|
|
|
|
/**
|
|
|
|
* To include native extensions, do NOT install node_modules for each one. They
|
|
|
|
* are not required as each extension is built using webpack.
|
|
|
|
*/
|
2019-01-19 00:46:40 +03:00
|
|
|
resources: [
|
|
|
|
path.join(__dirname, "../package.json"),
|
|
|
|
path.join(__dirname, "../build/**"),
|
|
|
|
],
|
2019-01-15 21:36:09 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notes for tmrw
|
|
|
|
*
|
|
|
|
* `upx ~/.nexe/linux` <- node binary before compiling with nexe
|
|
|
|
* Use `testing.js` for bundling with nexe to build
|
|
|
|
*/
|