Skip to content

Commit 54e587d

Browse files
committed
bundle as option
1 parent 07ad990 commit 54e587d

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

build.mjs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ var config = {
1616
//watch: process.argv.includes("--watch"),
1717
};
1818

19-
let build = true;
2019
let buildmode = process.argv.length > 2 ? process.argv[2] : 'default';
20+
let bundle = process.argv.length > 3 && process.argv[3] == 'bundle';
2121
switch (buildmode) {
22-
case 'bundleweb':
23-
build = false;
24-
break;
2522
case 'cmd':
2623
config = {
2724
entryPoints: ["igc2kmz/cmdwrapper.ts"],
@@ -47,11 +44,11 @@ switch (buildmode) {
4744
break;
4845
}
4946

50-
if (build) {
51-
await esbuild.build({
52-
...config,
53-
}).catch(() => process.exit(1))
54-
} else {
47+
await esbuild.build({
48+
...config,
49+
}).catch(() => process.exit(1));
50+
51+
if (bundle) {
5552
// BUNDLE
5653
const regtoreplace = /<script[\s\r\n]+src\s*=\s*(?:"|')([^"']+)(?:"|')[\s\r\n]*>/i;
5754
let htmli2k = fs.readFileSync('./igc2kmz.html', { encoding: 'utf8', flag: 'r' });
@@ -69,4 +66,4 @@ if (build) {
6966
}
7067
}
7168
fs.writeFileSync('./dist/igc2kmz_spa.html', htmli2k);
72-
}
69+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build": "node ./build.mjs cmd",
2121
"buildweb": "node ./build.mjs",
2222
"minify": "node ./build.mjs minify",
23-
"bundleweb": "npm run minify && node ./build.mjs bundleweb",
23+
"bundleweb": "node ./build.mjs minify bundle",
2424
"buildall": "npm run build && npm run buildweb && npm run bundleweb"
2525
},
2626
"devDependencies": {

0 commit comments

Comments
 (0)