update: scripts

This commit is contained in:
xiangyu 2023-01-11 12:56:29 +08:00
parent 05ad059c04
commit d48a628693
4 changed files with 14 additions and 24 deletions

7
.vscode/launch.json vendored
View File

@ -10,6 +10,13 @@
"name": "Restart", "name": "Restart",
"runtimeExecutable": "npm", "runtimeExecutable": "npm",
"runtimeArgs": ["run", "restart"], "runtimeArgs": ["run", "restart"],
},
{
"type": "node",
"request": "launch",
"name": "Restart in Prod Mode",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "restart-prod"],
} }
] ]
} }

View File

@ -12,11 +12,13 @@
"main": "src/index.ts", "main": "src/index.ts",
"scripts": { "scripts": {
"build-dev": "cross-env NODE_ENV=development node scripts/build.js", "build-dev": "cross-env NODE_ENV=development node scripts/build.js",
"build": "cross-env NODE_ENV=production node scripts/build.js", "build-prod": "cross-env NODE_ENV=production node scripts/build.js",
"build": "npm run build-prod",
"start": "node scripts/start.js", "start": "node scripts/start.js",
"stop": "node scripts/stop.js", "stop": "node scripts/stop.js",
"prerestart": "npm run build-dev", "restart-dev": "npm run build-dev && npm run stop && npm run start",
"restart": "node scripts/restart.js", "restart-prod": "npm run build-prod && npm run stop && npm run start",
"restart": "npm run restart-dev",
"release": "release-it", "release": "release-it",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
@ -31,7 +33,7 @@
}, },
"homepage": "https://github.com/windingwind/zotero-addon-template#readme", "homepage": "https://github.com/windingwind/zotero-addon-template#readme",
"dependencies": { "dependencies": {
"zotero-plugin-toolkit": "^1.0.1" "zotero-plugin-toolkit": "^1.0.3"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.11.17", "@types/node": "^18.11.17",

View File

@ -104,8 +104,8 @@ async function main() {
__env__: `"${process.env.NODE_ENV}"`, __env__: `"${process.env.NODE_ENV}"`,
}, },
bundle: true, bundle: true,
// Entry should be the same as addon/chrome/content/overlay.xul
outfile: path.join(buildDir, "addon/chrome/content/scripts/index.js"), outfile: path.join(buildDir, "addon/chrome/content/scripts/index.js"),
// Don't turn minify on
// minify: true, // minify: true,
}) })
.catch(() => process.exit(1)); .catch(() => process.exit(1));
@ -161,17 +161,6 @@ async function main() {
) )
); );
// _ = replace.sync({
// files: [path.join(buildDir, "addon/chrome/content/scripts/index.js")],
// from: [/__env__/g]
// });
// console.log(
// "[Build] Run replace in ",
// _.filter((f) => f.hasChanged).map(
// (f) => `${f.file} : ${f.numReplacements} / ${f.numMatches}`
// )
// );
console.log("[Build] Replace OK"); console.log("[Build] Replace OK");
console.log("[Build] Addon prepare OK"); console.log("[Build] Addon prepare OK");

View File

@ -1,8 +0,0 @@
const { execSync } = require("child_process");
const { killZotero, startZotero } = require("./zotero-cmd.json");
try {
execSync(killZotero);
} catch (e) {}
execSync(startZotero);