Add remove-manifest script

This commit is contained in:
hensm
2018-11-28 03:04:04 +00:00
parent ffb81c4168
commit 57f60abcd4
4 changed files with 18 additions and 24 deletions

View File

@@ -15,7 +15,7 @@ const CURRENT_MANIFEST_PATH = path.join(DIST_DIR_PATH, manifestName);
const WIN_REGISTRY_KEY = "fx_cast_bridge";
if (!fs.existsSync(CURRENT_MANIFEST_PATH)) {
if (!fs.existsSync(CURRENT_MANIFEST_PATH) && !argv.remove) {
console.error("No manifest in dist/app/ to install");
process.exit(1);
}
@@ -27,6 +27,11 @@ switch (platform) {
case "linux": {
const destination = path.join(os.homedir(), manifestPath[platform]);
if (argv.remove) {
fs.remove(path.join(destination, manifestName));
break;
}
fs.ensureDirSync(destination);
fs.copyFileSync(CURRENT_MANIFEST_PATH
, path.join(destination, manifestName));
@@ -37,6 +42,11 @@ switch (platform) {
case "win32": {
const regedit = require("regedit");
if (argv.remove) {
// TODO: no corresponding method in regedit lib
break;
}
regedit.putValue({
"HKEY_CURRENT_USER\\SOFTWARE\\Mozilla\\NativeMessagingHosts": {
[WIN_REGISTRY_KEY]: {

View File

@@ -1,21 +0,0 @@
require('@babel/register')({
presets: [
[
"@babel/preset-env"
, {
targets: {
node: "current"
}
}
]
]
, plugins: [
"@babel/plugin-transform-runtime"
, "@babel/plugin-syntax-dynamic-import"
, "@babel/plugin-syntax-import-meta"
, "@babel/plugin-proposal-class-properties"
, "@babel/plugin-proposal-json-strings"
]
});
require('../src/js/main');