From 3738657b9a040071b2ebe1a86322ccf50ea5b72a Mon Sep 17 00:00:00 2001 From: Northword Date: Fri, 14 Jul 2023 15:51:50 +0800 Subject: [PATCH 1/3] fix: check manifest before start --- scripts/start.mjs | 8 +++++++- scripts/zotero-cmd-default.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/start.mjs b/scripts/start.mjs index ffb303c..183e69c 100644 --- a/scripts/start.mjs +++ b/scripts/start.mjs @@ -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( diff --git a/scripts/zotero-cmd-default.json b/scripts/zotero-cmd-default.json index 9be4de9..f9e5f74 100644 --- a/scripts/zotero-cmd-default.json +++ b/scripts/zotero-cmd-default.json @@ -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", From 8a36eb2ab6c494b7a41ba6c0a8e612c9881bdcf3 Mon Sep 17 00:00:00 2001 From: Northword Date: Mon, 17 Jul 2023 10:26:43 +0800 Subject: [PATCH 2/3] fix: typo --- scripts/zotero-cmd-default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zotero-cmd-default.json b/scripts/zotero-cmd-default.json index f9e5f74..c02a99f 100644 --- a/scripts/zotero-cmd-default.json +++ b/scripts/zotero-cmd-default.json @@ -13,7 +13,7 @@ "profilePath": "/path/to/profile", "@comment-dataDir": "Please input the directory where the database is located in dataDir", - "@comment-dataDir-tip": "If this field is kept empty, Zotero will start with the default date.", + "@comment-dataDir-tip": "If this field is kept empty, Zotero will start with the default data.", "@comment-dataDir-see": "https://www.zotero.org/support/zotero_data", "dataDir": "" } From 9495059eb992e6ac5f7ec5764e1c30f3d53472a2 Mon Sep 17 00:00:00 2001 From: Northword Date: Mon, 17 Jul 2023 10:28:41 +0800 Subject: [PATCH 3/3] fix: remove `\n` in template literals --- scripts/start.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/start.mjs b/scripts/start.mjs index 183e69c..561a298 100644 --- a/scripts/start.mjs +++ b/scripts/start.mjs @@ -25,9 +25,9 @@ if (existsSync(profilePath)) { function writeAddonProxyFile() { writeFileSync(addonProxyFilePath, buildPath); console.log( - `[info] Addon proxy file has been updated. \n - File path: ${addonProxyFilePath} \n - Addon path: ${buildPath} \n`, + `[info] Addon proxy file has been updated. + File path: ${addonProxyFilePath} + Addon path: ${buildPath} `, ); }