update: plugin template

This commit is contained in:
windingwind 2024-01-01 18:51:07 +08:00
parent bea7cc30d5
commit 150aa6f6fe
2 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,7 @@
"stop": "node scripts/stop.mjs",
"lint": "prettier --write . && eslint . --ext .ts --fix",
"test": "echo \"Error: no test specified\" && exit 1",
"release": "release-it",
"release": "release-it --only-version --preReleaseId=beta",
"update-deps": "npm update --save"
},
"repository": {

View File

@ -2,7 +2,7 @@ import details from "../package.json" assert { type: "json" };
import { Logger } from "./utils.mjs";
import cmd from "./zotero-cmd.json" assert { type: "json" };
import { spawn } from "child_process";
import { existsSync, readFileSync, writeFileSync } from "fs";
import { existsSync, readFileSync, writeFileSync, rmSync } from "fs";
import { clearFolder } from "./utils.mjs";
import path from "path";
import { exit } from "process";
@ -45,6 +45,11 @@ function prepareDevEnv() {
writeAddonProxyFile();
}
const addonXpiFilePath = path.join(profilePath, `extensions/${addonID}.xpi`);
if (existsSync(addonXpiFilePath)) {
rmSync(addonXpiFilePath);
}
const prefsPath = path.join(profilePath, "prefs.js");
if (existsSync(prefsPath)) {
const PrefsLines = readFileSync(prefsPath, "utf-8").split("\n");