zotero-plugin-scaffold 0.1.8-beta.3 → 0.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { globbySync } from 'globby';
5
5
  import mime from 'mime';
6
6
  import { Octokit } from 'octokit';
7
7
  import { isCI } from 'std-env';
8
- import { a as Base } from '../shared/zotero-plugin-scaffold.815a2d51.mjs';
8
+ import { a as Base } from '../shared/zotero-plugin-scaffold.619ed490.mjs';
9
9
  import 'c12';
10
10
  import 'es-toolkit';
11
11
  import 'hookable';
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import process, { exit, env } from 'node:process';
3
3
  import { Command } from '@commander-js/extra-typings';
4
4
  import updateNotifier from 'update-notifier';
5
- import { L as Log, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.815a2d51.mjs';
5
+ import { L as Log, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.619ed490.mjs';
6
6
  import 'node:path';
7
7
  import 'c12';
8
8
  import 'es-toolkit';
@@ -27,7 +27,7 @@ import 'xvfb-ts';
27
27
 
28
28
  const name = "zotero-plugin-scaffold";
29
29
  const type = "module";
30
- const version = "0.1.8-beta.3";
30
+ const version = "0.2.0-beta.4";
31
31
  const packageManager = "pnpm@9.14.4";
32
32
  const description = "A scaffold for Zotero plugin development.";
33
33
  const author = "northword";
package/dist/index.d.mts CHANGED
@@ -633,7 +633,7 @@ interface TestConfig {
633
633
  *
634
634
  * 测试的超时时间。
635
635
  *
636
- * @default 5000
636
+ * @default 10000
637
637
  */
638
638
  timeout: number;
639
639
  };
@@ -661,6 +661,19 @@ interface TestConfig {
661
661
  * @default false
662
662
  */
663
663
  exitOnFinish: boolean;
664
+ /**
665
+ * Run Zotero in deadless mode.
666
+ *
667
+ * - Supported for Linux only.
668
+ * - Default to true when in CI environments.
669
+ *
670
+ * 使用无头模式运行 Zotero。
671
+ *
672
+ * - 仅支持 Linux
673
+ * - 在 CI 模式下,默认为 true
674
+ *
675
+ * @default false
676
+ */
664
677
  headless: boolean;
665
678
  /**
666
679
  * The delay time before running the test. Make sure the plugin is fully loaded before running the test.
package/dist/index.d.ts CHANGED
@@ -633,7 +633,7 @@ interface TestConfig {
633
633
  *
634
634
  * 测试的超时时间。
635
635
  *
636
- * @default 5000
636
+ * @default 10000
637
637
  */
638
638
  timeout: number;
639
639
  };
@@ -661,6 +661,19 @@ interface TestConfig {
661
661
  * @default false
662
662
  */
663
663
  exitOnFinish: boolean;
664
+ /**
665
+ * Run Zotero in deadless mode.
666
+ *
667
+ * - Supported for Linux only.
668
+ * - Default to true when in CI environments.
669
+ *
670
+ * 使用无头模式运行 Zotero。
671
+ *
672
+ * - 仅支持 Linux
673
+ * - 在 CI 模式下,默认为 true
674
+ *
675
+ * @default false
676
+ */
664
677
  headless: boolean;
665
678
  /**
666
679
  * The delay time before running the test. Make sure the plugin is fully loaded before running the test.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.815a2d51.mjs';
1
+ export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.619ed490.mjs';
2
2
  import 'node:path';
3
3
  import 'c12';
4
4
  import 'es-toolkit';
@@ -1634,7 +1634,7 @@ mocha.run();
1634
1634
  res.writeHead(200, { "Content-Type": "application/json" });
1635
1635
  res.end(JSON.stringify({ message: "Results received successfully" }));
1636
1636
  } catch (error) {
1637
- console.error("Error parsing JSON:", error);
1637
+ this.logger.error("Error parsing JSON:", error);
1638
1638
  res.writeHead(400, { "Content-Type": "application/json" });
1639
1639
  res.end(JSON.stringify({ error: "Invalid JSON" }));
1640
1640
  }
@@ -1686,46 +1686,37 @@ mocha.run();
1686
1686
  process.env.ZOTERO_PLUGIN_ZOTERO_BIN_PATH = `${cwd()}/Zotero_linux-x86_64/zotero`;
1687
1687
  }
1688
1688
  async installXvfb() {
1689
+ if (!isLinux) {
1690
+ this.logger.error("Unsupported platform. Please install Xvfb manually.");
1691
+ process.exit(1);
1692
+ }
1689
1693
  try {
1690
1694
  execSync("which xvfb", { stdio: "ignore" });
1691
1695
  } catch {
1692
- if (isLinux) {
1693
- try {
1694
- const osId = execSync("cat /etc/os-release | grep '^ID='").toString();
1695
- if (osId.includes("ubuntu") || osId.includes("debian")) {
1696
- this.logger.debug("Detected Ubuntu/Debian. Installing Xvfb...");
1697
- execSync("sudo apt-get update && sudo apt-get install -y xvfb", { stdio: "inherit" });
1698
- } else if (osId.includes("centos") || osId.includes("rhel")) {
1699
- this.logger.debug("Detected CentOS/RHEL. Installing Xvfb...");
1700
- execSync("sudo yum install -y xorg-x11-server-Xvfb", { stdio: "inherit" });
1701
- } else {
1702
- throw new Error("Unsupported Linux distribution.");
1703
- }
1704
- this.logger.debug("Xvfb installation completed.");
1705
- } catch (error) {
1706
- console.error("Failed to install Xvfb:", error);
1707
- process.exit(1);
1708
- }
1709
- } else if (isMacOS) {
1710
- this.logger.debug("Detected macOS. Installing XQuartz...");
1711
- try {
1712
- execSync("brew install xquartz", { stdio: "inherit" });
1713
- this.logger.debug("XQuartz installation completed.");
1714
- } catch (error) {
1715
- console.error("Failed to install XQuartz:", error);
1716
- process.exit(1);
1696
+ try {
1697
+ const osId = execSync("cat /etc/os-release | grep '^ID='").toString();
1698
+ if (osId.includes("ubuntu") || osId.includes("debian")) {
1699
+ this.logger.debug("Detected Ubuntu/Debian. Installing Xvfb...");
1700
+ execSync("sudo apt-get update && sudo apt-get install -y xvfb", { stdio: "pipe" });
1701
+ } else if (osId.includes("centos") || osId.includes("rhel")) {
1702
+ this.logger.debug("Detected CentOS/RHEL. Installing Xvfb...");
1703
+ execSync("sudo yum install -y xorg-x11-server-Xvfb", { stdio: "pipe" });
1704
+ } else {
1705
+ throw new Error("Unsupported Linux distribution.");
1717
1706
  }
1718
- } else {
1719
- console.error("Unsupported platform. Please install Xvfb manually.");
1707
+ this.logger.debug("Xvfb installation completed.");
1708
+ } catch (error) {
1709
+ this.logger.error("Failed to install Xvfb:", error);
1720
1710
  process.exit(1);
1721
1711
  }
1722
1712
  }
1723
1713
  }
1724
1714
  async installZoteroLinux() {
1725
1715
  try {
1726
- execSync("wget -O zotero.tar.bz2 'https://www.zotero.org/download/client/dl?platform=linux-x86_64&channel=beta'");
1727
- execSync("tar -xvf zotero.tar.bz2");
1728
- } catch {
1716
+ execSync("wget -O zotero.tar.bz2 'https://www.zotero.org/download/client/dl?platform=linux-x86_64&channel=beta'", { stdio: "pipe" });
1717
+ execSync("tar -xvf zotero.tar.bz2", { stdio: "pipe" });
1718
+ } catch (e) {
1719
+ this.logger.error(e);
1729
1720
  throw new Error("Zotero extracted failed");
1730
1721
  }
1731
1722
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
3
  "type": "module",
4
- "version": "0.1.8-beta.3",
4
+ "version": "0.2.0-beta.4",
5
5
  "description": "A scaffold for Zotero plugin development.",
6
6
  "author": "northword",
7
7
  "license": "AGPL-3.0-or-later",