-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
38 lines (33 loc) · 1016 Bytes
/
build.js
File metadata and controls
38 lines (33 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const {makePackage, Operations} = require('./src/lib/developerApi');
const path = require('node:path');
const fs = require('node:fs');
require('module-alias/register');
const wantedSrcFolder = process.argv[2]
if(!wantedSrcFolder) {
exitError("No source folder")
}
if(!fs.existsSync(wantedSrcFolder +".src")) {
exitError("Source ID " + wantedSrcFolder +" not found.")
}
const wantedOpts = [];
for(const str of process.argv) {
if(str.startsWith("--o:")) {
const wantedOpt = str.split("--o:")[1];
if(wantedOpt in Operations) {
wantedOpts.push(Operations[wantedOpt])
} else {
exitError("Operation " + wantedOpt +" not recognized. Applicable types are: " + Object.keys(Operations))
}
}
}
makePackage({
id: wantedSrcFolder,
src: path.resolve(`${wantedSrcFolder}.src`),
out: path.resolve("./plugins"),
extra: wantedOpts
});
function exitError(str) {
console.error(str);
console.log(`Usage: node build.js <sourceID> [--o:INSTALL_DEPS_PRE_PACKAGE]`);
process.exit(1);
}