fix: check manifest before start
This commit is contained in:
		
							parent
							
								
									229411ae61
								
							
						
					
					
						commit
						3738657b9a
					
				@ -9,13 +9,19 @@ const { addonID } = details.config;
 | 
			
		||||
const { zoteroBinPath, profilePath, dataDir } = cmd.exec;
 | 
			
		||||
 | 
			
		||||
if (!existsSync(zoteroBinPath)) {
 | 
			
		||||
  throw new Error("Zotero bin do no exist.");
 | 
			
		||||
  throw new Error("Zotero binary does not exist.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (existsSync(profilePath)) {
 | 
			
		||||
  const addonProxyFilePath = path.join(profilePath, `extensions/${addonID}`);
 | 
			
		||||
  const buildPath = path.resolve("build/addon");
 | 
			
		||||
 | 
			
		||||
  if (!existsSync(path.join(buildPath, "./manifest.json"))) {
 | 
			
		||||
    throw new Error(
 | 
			
		||||
      `The built file does not exist, maybe you need to build the addon first.`,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function writeAddonProxyFile() {
 | 
			
		||||
    writeFileSync(addonProxyFilePath, buildPath);
 | 
			
		||||
    console.log(
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,7 @@
 | 
			
		||||
    "zoteroBinPath": "/path/to/zotero.exe",
 | 
			
		||||
 | 
			
		||||
    "@comment-profilePath": "Please input the path of the profile used for development in `profilePath`.",
 | 
			
		||||
    "@comment-profilePath-tip": "If this field is kept empty, Zotero will start with the default profile.",
 | 
			
		||||
    "@comment-profilePath-tip": "Start the profile manager by `/path/to/zotero.exe -p` to create a profile for development",
 | 
			
		||||
    "@comment-profilePath-see": "https://www.zotero.org/support/kb/profile_directory",
 | 
			
		||||
    "profilePath": "/path/to/profile",
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user