zotero-plugin 2.0.0 → 2.0.2

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/release.js CHANGED
@@ -49,7 +49,7 @@ const issues = new Set(Array.from(tags).map(parseInt).filter(tag => !isNaN(tag))
49
49
  if ((/^((issue|gh)-)?[0-9]+(-[a-z]+)?$/i).exec(continuous_integration_1.ContinuousIntegration.branch)) {
50
50
  issues.add(parseInt(continuous_integration_1.ContinuousIntegration.branch.replace(/[^0-9]/g, '')));
51
51
  }
52
- async function announce(issue, release) {
52
+ async function announce(issue_number, release) {
53
53
  if (tags.has('noannounce'))
54
54
  return;
55
55
  let build;
@@ -65,18 +65,23 @@ async function announce(issue, release) {
65
65
  reason = ` (${JSON.stringify(continuous_integration_1.ContinuousIntegration.commit_message)})`;
66
66
  reason += `\n\nInstall in Zotero by downloading ${link}, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".`;
67
67
  }
68
- const msg = `:robot: this is your friendly neighborhood build bot announcing ${link}${reason}`;
69
- report(msg);
68
+ const body = `:robot: this is your friendly neighborhood build bot announcing ${link}${reason}`;
69
+ report(body);
70
70
  if (dryRun)
71
71
  return;
72
72
  try {
73
- await octokit.issues.createComment({ owner, repo, issue_number: issue, body: msg });
73
+ const locked = (await octokit.issues.get({ owner, repo, issue_number })).data.locked;
74
+ if (locked)
75
+ await octokit.issues.unlock({ owner, repo, issue_number });
76
+ await octokit.issues.createComment({ owner, repo, issue_number, body });
77
+ if (locked)
78
+ await octokit.issues.lock({ owner, repo, issue_number });
74
79
  }
75
80
  catch (error) {
76
- console.log(`Failed to announce '${build}: ${reason}' on ${issue}`); // eslint-disable-line no-console
81
+ console.log(`Failed to announce '${build}: ${reason}' on ${issue_number}`); // eslint-disable-line no-console
77
82
  }
78
83
  if (process.env.GITHUB_ENV)
79
- fs.appendFileSync(process.env.GITHUB_ENV, `XPI_RELEASED=${issue}\n`);
84
+ fs.appendFileSync(process.env.GITHUB_ENV, `XPI_RELEASED=${issue_number}\n`);
80
85
  }
81
86
  async function uploadAsset(release, asset, contentType) {
82
87
  report(`uploading ${path.basename(asset)} to ${release.data.tag_name}`);
package/debug-log.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ export declare function unregister(plugin: string): void;
1
2
  declare class DebugLogSender {
2
- private enabled;
3
- private plugins;
3
+ plugins: Record<string, string[]>;
4
4
  register(plugin: string, preferences?: string[]): void;
5
5
  unregister(plugin: string): void;
6
6
  private alert;
package/debug-log.js CHANGED
@@ -1,18 +1,27 @@
1
1
  "use strict";
2
2
  /* eslint-disable no-magic-numbers */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DebugLog = void 0;
4
+ exports.DebugLog = exports.unregister = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const tar_js_1 = tslib_1.__importDefault(require("tar-js"));
7
7
  const pako_1 = require("pako");
8
+ function unregister(plugin) {
9
+ Zotero.debug(`debug-log-sender: unregistering ${plugin}`);
10
+ delete Zotero.DebugLogSender.plugins[plugin];
11
+ if (!Object.keys(Zotero.DebugLogSender.plugins).length) {
12
+ const doc = Zotero.getMainWindow().document;
13
+ const menuitem = doc.querySelector('menuitem#debug-log-menu');
14
+ if (menuitem)
15
+ menuitem.remove();
16
+ }
17
+ }
18
+ exports.unregister = unregister;
8
19
  class DebugLogSender {
9
20
  constructor() {
10
- this.enabled = false;
11
21
  this.plugins = {};
12
22
  }
13
23
  register(plugin, preferences = []) {
14
24
  this.plugins[plugin] = preferences;
15
- this.enabled = true;
16
25
  const doc = Zotero.getMainWindow().document;
17
26
  Zotero.debug(`debug-log-sender: registering ${plugin}`);
18
27
  if (!doc.querySelector('menuitem#debug-log-menu')) {
@@ -27,14 +36,7 @@ class DebugLogSender {
27
36
  }
28
37
  }
29
38
  unregister(plugin) {
30
- Zotero.debug(`debug-log-sender: unregistering ${plugin}`);
31
- delete this.plugins[plugin];
32
- if (!Object.keys(this.plugins).length) {
33
- const doc = Zotero.getMainWindow().document;
34
- const menuitem = doc.querySelector('menuitem#debug-log-menu');
35
- if (menuitem)
36
- menuitem.remove();
37
- }
39
+ unregister(plugin);
38
40
  }
39
41
  alert(title, body) {
40
42
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zotero-plugin",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Zotero plugin builder",
5
5
  "homepage": "https://github.com/retorquere/zotero-plugin/wiki",
6
6
  "bin": {