diff --git a/README.md b/README.md index 9671d8b..33367b2 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ Steps in `scripts/build.mjs`: - Create/empty `build/`. - Copy `addon/**` to `build/addon/**` - Replace placeholders: use `replace-in-file` to replace keywords and configurations defined in `package.json` in non-build files (`xhtml`, `json`, et al.). -- Prepare locale files to [avaid conflict](https://www.zotero.org/support/dev/zotero_7_for_developers#avoiding_localization_conflicts) +- Prepare locale files to [avoid conflict](https://www.zotero.org/support/dev/zotero_7_for_developers#avoiding_localization_conflicts) - Rename `**/*.flt` to `**/${addonRef}-*.flt` - Prefix each fluent message with `addonRef-` - Use Esbuild to build `.ts` source code to `.js`, build `src/index.ts` to `./build/addon/chrome/content/scripts`. diff --git a/scripts/start.mjs b/scripts/start.mjs index b916b5a..d45fea4 100644 --- a/scripts/start.mjs +++ b/scripts/start.mjs @@ -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");