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

View File

@@ -6,7 +6,7 @@
"build": "node bin/build.js", "build": "node bin/build.js",
"package": "node bin/build.js --package", "package": "node bin/build.js --package",
"install-manifest": "node bin/install-manifest.js", "install-manifest": "node bin/install-manifest.js",
"start-debug": "node bin/start-debug.js" "remove-manifest": "node bin/install-manifest.js --remove"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.0.0", "@babel/runtime": "^7.0.0",

View File

@@ -3,14 +3,19 @@
"postinstall": "npm run postinstall:app && npm run postinstall:ext", "postinstall": "npm run postinstall:app && npm run postinstall:ext",
"postinstall:app": "npm install ./app --prefix ./app", "postinstall:app": "npm install ./app --prefix ./app",
"postinstall:ext": "npm install ./ext --prefix ./ext", "postinstall:ext": "npm install ./ext --prefix ./ext",
"build": "npm run build:app && npm run build:ext", "build": "npm run build:app && npm run build:ext",
"build:app": "npm run build --prefix ./app", "build:app": "npm run build --prefix ./app",
"build:ext": "npm run build --prefix ./ext", "build:ext": "npm run build --prefix ./ext",
"package": "npm run package:app && npm run package:ext", "package": "npm run package:app && npm run package:ext",
"package:app": "npm run package --prefix ./app", "package:app": "npm run package --prefix ./app",
"package:ext": "npm run package --prefix ./ext", "package:ext": "npm run package --prefix ./ext",
"test": "jasmine --config=jasmine.json", "test": "jasmine --config=jasmine.json",
"install-manifest": "npm run install-manifest --prefix ./app"
"install-manifest": "npm run install-manifest --prefix ./app",
"remove-manifest": "npm run remove-manifest --prefix ./app"
}, },
"devDependencies": { "devDependencies": {
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",