zotero-plugin 6.0.2 → 6.1.0

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.
package/bin/fetch-log.mjs CHANGED
@@ -11,7 +11,7 @@ import { Entry as KeyRingEntry } from "@napi-rs/keyring";
11
11
  import prompts from "prompts";
12
12
 
13
13
  // package.json
14
- var version = "6.0.2";
14
+ var version = "6.1.0";
15
15
 
16
16
  // bin/crypto.ts
17
17
  import crypto from "crypto";
package/bin/release.mjs CHANGED
@@ -15,7 +15,7 @@ var require_package = __commonJS({
15
15
  "package.json"(exports, module) {
16
16
  module.exports = {
17
17
  name: "zotero-plugin",
18
- version: "6.0.2",
18
+ version: "6.1.0",
19
19
  description: "Zotero plugin builder",
20
20
  homepage: "https://github.com/retorquere/zotero-plugin/wiki",
21
21
  bin: {
package/bin/start.mjs CHANGED
@@ -1,15 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // bin/start.ts
4
- import { exec as childProcessExec } from "child_process";
4
+ import { exec, spawn } from "child_process";
5
5
  import { program } from "commander";
6
6
  import fs from "fs";
7
7
  import { globSync } from "glob";
8
8
  import ini from "ini";
9
9
  import os from "os";
10
10
  import path from "path";
11
- import { promisify } from "util";
12
- var execPromise = promisify(childProcessExec);
13
11
  program.option("-b, --beta", "start beta");
14
12
  program.parse(process.argv);
15
13
  var options = program.opts();
@@ -123,24 +121,20 @@ function patch_prefs(prefs, add_config) {
123
121
  }
124
122
  fs.writeFileSync(prefs_path, new_lines.join("\n"));
125
123
  }
126
- async function system(cmd) {
127
- console.log("$", cmd);
128
- try {
129
- const { stdout, stderr } = await execPromise(cmd);
130
- if (stdout) console.log(stdout);
131
- if (stderr) console.error(stderr);
132
- } catch (error) {
133
- const err = error;
134
- console.error(`Command failed with exit code ${err.code || 1}: ${err.message}`);
135
- process.exit(err.code || 1);
136
- }
137
- }
138
124
  async function main() {
139
125
  try {
140
126
  patch_prefs("prefs", false);
141
127
  patch_prefs("user", true);
142
128
  if (config.plugin.build) {
143
- await system(config.plugin.build);
129
+ await new Promise((resolve, reject) => {
130
+ exec(config.plugin.build, (error, stdout, stderr) => {
131
+ if (error) {
132
+ reject(error);
133
+ } else {
134
+ resolve();
135
+ }
136
+ });
137
+ });
144
138
  }
145
139
  if (config.zotero.db) {
146
140
  fs.copyFileSync(config.zotero.db, path.join(config.profile.path, "zotero", "zotero.sqlite"));
@@ -157,22 +151,27 @@ async function main() {
157
151
  console.log("Source path:", sources);
158
152
  console.log("Proxy file path:", plugin_path);
159
153
  fs.writeFileSync(plugin_path, proxyPath);
160
- const zoteroDebugFlag = config.windows ? "-ZoteroDebug" : "-ZoteroDebugText";
161
- const cmdParts = [
154
+ const cmd = [
162
155
  config.zotero.path,
163
156
  "-purgecaches",
164
157
  "-P",
165
158
  config.profile.name,
166
- zoteroDebugFlag,
159
+ config.windows ? "-ZoteroDebug" : "-ZoteroDebugText",
167
160
  "-jsconsole",
168
161
  "-datadir",
169
162
  "profile"
170
163
  ];
164
+ let child;
171
165
  if (config.zotero.log) {
172
- cmdParts.push(`> ${config.zotero.log}`);
173
- if (!config.windows) cmdParts.push("&");
166
+ const log = fs.openSync(config.zotero.log, "w");
167
+ child = spawn(cmd[0], cmd.slice(1), {
168
+ detached: true,
169
+ stdio: ["ignore", log, "ignore"]
170
+ });
171
+ } else {
172
+ child = spawn(cmd[0], cmd.slice(1));
174
173
  }
175
- await system(cmdParts.join(" "));
174
+ child.unref();
176
175
  } catch (err) {
177
176
  console.error(err);
178
177
  }
package/manifest.js CHANGED
@@ -11,7 +11,7 @@ const root_1 = tslib_1.__importDefault(require("./root"));
11
11
  const version_1 = tslib_1.__importDefault(require("./version"));
12
12
  const pkg = { ...require(path.join(root_1.default, 'package.json')) };
13
13
  if (!pkg.id)
14
- pkg.id = `${pkg.name.replace(/^zotero-/, '')}@${pkg.author.email.replace(/.*@/, '')}`.toLowerCase();
14
+ pkg.id = `${pkg.name}@${pkg.author.email.replace(/.*@/, '')}`.toLowerCase();
15
15
  if (pkg.xpi)
16
16
  Object.assign(pkg, pkg.xpi);
17
17
  pkg.version = version_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zotero-plugin",
3
- "version": "6.0.2",
3
+ "version": "6.1.0",
4
4
  "description": "Zotero plugin builder",
5
5
  "homepage": "https://github.com/retorquere/zotero-plugin/wiki",
6
6
  "bin": {