mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 10:09:59 +00:00
Define build script arguments
This commit is contained in:
36
ext/build.js
36
ext/build.js
@@ -1,22 +1,29 @@
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const { spawn } = require("child_process");
|
||||
const argv = require("minimist")(process.argv.slice(2));
|
||||
const minimist = require("minimist");
|
||||
|
||||
|
||||
const extensionName = "fx_cast";
|
||||
const extensionId = "fx_cast@matt.tf";
|
||||
const extensionVersion = "0.0.1";
|
||||
|
||||
const argv = minimist(process.argv.slice(2), {
|
||||
boolean: [ "package", "watch" ]
|
||||
, string: [ "mirroringAppId", "mode" ]
|
||||
, default: {
|
||||
package: false
|
||||
, watch: false
|
||||
, mirroringAppId: "19A6F4AE"
|
||||
, mode: "development"
|
||||
}
|
||||
});
|
||||
|
||||
if (argv.package) {
|
||||
argv.mode = "production";
|
||||
argv.watch = false;
|
||||
}
|
||||
|
||||
// Default argument values
|
||||
const { mirroringAppId = "19A6F4AE"
|
||||
, mode = "development" } = argv;
|
||||
|
||||
const extensionName = "fx_cast";
|
||||
const extensionId = "fx_cast@matt.tf";
|
||||
const extensionVersion = "0.0.1";
|
||||
|
||||
// Clean
|
||||
fs.removeSync(path.join(__dirname, "../dist/ext/"));
|
||||
@@ -25,12 +32,13 @@ const child = spawn(
|
||||
`webpack --env.extensionName=${extensionName} `
|
||||
+ `--env.extensionId=${extensionId} `
|
||||
+ `--env.extensionVersion=${extensionVersion} `
|
||||
+ `--env.mirroringAppId=${mirroringAppId} `
|
||||
+ `--mode=${mode} `
|
||||
+ `${argv.watch ? "--watch" : ""} `
|
||||
+ `&& web-ext build --overwrite-dest `
|
||||
+ `--source-dir ../dist/ext/unpacked `
|
||||
+ `--artifacts-dir ../dist/ext `
|
||||
+ `--env.mirroringAppId=${argv.mirroringAppId} `
|
||||
+ `--mode=${argv.mode} `
|
||||
+ `${argv.watch ? "--watch" : ""} && `
|
||||
|
||||
+ `web-ext build --overwrite-dest `
|
||||
+ `--source-dir ../dist/ext/unpacked `
|
||||
+ `--artifacts-dir ../dist/ext `
|
||||
, { shell: true }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user