Remove original xpi file if exists in extensions folder (#90)
				
					
				
			* remove original xpi file in extensions folder to avoid load add-on from xpi * Update README.md
This commit is contained in:
		
							parent
							
								
									f5f2fd3297
								
							
						
					
					
						commit
						fc8a4ac9d9
					
				@ -251,7 +251,7 @@ Steps in `scripts/build.mjs`:
 | 
				
			|||||||
- Create/empty `build/`.
 | 
					- Create/empty `build/`.
 | 
				
			||||||
- Copy `addon/**` to `build/addon/**`
 | 
					- 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.).
 | 
					- 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`
 | 
					  - Rename `**/*.flt` to `**/${addonRef}-*.flt`
 | 
				
			||||||
  - Prefix each fluent message with `addonRef-`
 | 
					  - 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`.
 | 
					- Use Esbuild to build `.ts` source code to `.js`, build `src/index.ts` to `./build/addon/chrome/content/scripts`.
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ import details from "../package.json" assert { type: "json" };
 | 
				
			|||||||
import { Logger } from "./utils.mjs";
 | 
					import { Logger } from "./utils.mjs";
 | 
				
			||||||
import cmd from "./zotero-cmd.json" assert { type: "json" };
 | 
					import cmd from "./zotero-cmd.json" assert { type: "json" };
 | 
				
			||||||
import { spawn } from "child_process";
 | 
					import { spawn } from "child_process";
 | 
				
			||||||
import { existsSync, readFileSync, writeFileSync } from "fs";
 | 
					import { existsSync, readFileSync, writeFileSync, rmSync } from "fs";
 | 
				
			||||||
import { clearFolder } from "./utils.mjs";
 | 
					import { clearFolder } from "./utils.mjs";
 | 
				
			||||||
import path from "path";
 | 
					import path from "path";
 | 
				
			||||||
import { exit } from "process";
 | 
					import { exit } from "process";
 | 
				
			||||||
@ -45,6 +45,11 @@ function prepareDevEnv() {
 | 
				
			|||||||
    writeAddonProxyFile();
 | 
					    writeAddonProxyFile();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const addonXpiFilePath = path.join(profilePath, `extensions/${addonID}.xpi`);
 | 
				
			||||||
 | 
					  if (existsSync(addonXpiFilePath)) {
 | 
				
			||||||
 | 
					    rmSync(addonXpiFilePath);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const prefsPath = path.join(profilePath, "prefs.js");
 | 
					  const prefsPath = path.join(profilePath, "prefs.js");
 | 
				
			||||||
  if (existsSync(prefsPath)) {
 | 
					  if (existsSync(prefsPath)) {
 | 
				
			||||||
    const PrefsLines = readFileSync(prefsPath, "utf-8").split("\n");
 | 
					    const PrefsLines = readFileSync(prefsPath, "utf-8").split("\n");
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user