zotero-plugin 4.0.3 → 5.0.1

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
@@ -8137,7 +8137,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
8137
8137
  "package.json"(exports, module) {
8138
8138
  module.exports = {
8139
8139
  name: "zotero-plugin",
8140
- version: "4.0.3",
8140
+ version: "5.0.1",
8141
8141
  description: "Zotero plugin builder",
8142
8142
  homepage: "https://github.com/retorquere/zotero-plugin/wiki",
8143
8143
  bin: {
@@ -11509,7 +11509,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
11509
11509
  process.on("unhandledRejection", (up) => {
11510
11510
  throw up;
11511
11511
  });
11512
- program.version(require_package2().version).option("-r, --release-message <value>", "add message to github release").option("-x, --xpi <value>", "xpi filename template", "{name}-{version}.xpi").option("-d, --dry-run", "dry run", !ContinuousIntegration.service).option("-p, --pre-release", "release is a pre-release").option("-t, --tag", "tag for release", ContinuousIntegration.tag).parse(process.argv);
11512
+ program.version(require_package2().version).option("-r, --release-message <value>", "add message to github release").option("-x, --xpi <value>", "xpi filename template", "{name}-{version}.xpi").option("-d, --dry-run", "dry run", !ContinuousIntegration.service).option("-p, --pre-release", "release is a pre-release").option("-t, --tag <value>", "tag for release", ContinuousIntegration.tag).parse(process.argv);
11513
11513
  var options = program.opts();
11514
11514
  if (options.tag && options.tag !== ContinuousIntegration.tag) {
11515
11515
  console.log("dry-run: tag specified manually, switching to dry-run mode");
@@ -11623,8 +11623,8 @@ This update may name other issues, but the build just dropped here is for you; i
11623
11623
  const release = await getRelease(releases_tag, false);
11624
11624
  const assets = (await octokit.repos.listReleaseAssets({ owner, repo, release_id: release.data.id })).data;
11625
11625
  const updates = {
11626
- "update.rdf": !pkg.xpi.update || pkg.xpi.update.rdf ? "application/rdf+xml" : "",
11627
- "updates.json": !pkg.xpi.update || pkg.xpi.updates.json ? "application/json" : ""
11626
+ "update.rdf": (pkg.xpi?.minVersion || "6").match(/^6/) ? "application/rdf+xml" : "",
11627
+ "updates.json": (pkg.xpi?.maxVersion || "7").match(/^7/) ? "application/json" : ""
11628
11628
  };
11629
11629
  for (const asset of assets) {
11630
11630
  if (asset.name in updates && updates[asset.name]) {
package/install.rdf.pug CHANGED
@@ -25,5 +25,5 @@ RDF(xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.moz
25
25
  em:targetApplication
26
26
  Description
27
27
  em:id zotero@chnm.gmu.edu
28
- em:minVersion #{zotero || '6.0.9'}
29
- em:maxVersion 7.*
28
+ em:minVersion= minVersion
29
+ em:maxVersion= maxVersion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zotero-plugin",
3
- "version": "4.0.3",
3
+ "version": "5.0.1",
4
4
  "description": "Zotero plugin builder",
5
5
  "homepage": "https://github.com/retorquere/zotero-plugin/wiki",
6
6
  "bin": {
package/rdf.js CHANGED
@@ -35,79 +35,83 @@ for (const translation of translations) {
35
35
  pkg.localizedDescriptions[locale] = description;
36
36
  }
37
37
  }
38
- const options_and_vars = Object.assign(Object.assign({}, pkg), { pretty: true });
38
+ const options_and_vars = Object.assign(Object.assign({ minVersion: '6.0.9', maxVersion: '7.*' }, pkg), { pretty: true });
39
39
  try {
40
40
  Object.assign(options_and_vars, JSON.parse(fs.readFileSync(path.join(root_1.default, 'schema', 'supported.json'), 'utf8')));
41
41
  }
42
42
  catch (err) { // eslint-disable-line @typescript-eslint/no-unused-vars
43
43
  // ignore
44
44
  }
45
- let template;
46
- console.log('generating install.rdf');
47
- template = fs.readFileSync(path.join(__dirname, 'install.rdf.pug'), 'utf8');
48
- template = pug.render(template, options_and_vars);
49
- fs.writeFileSync(path.join(root_1.default, 'build/install.rdf'), template, { encoding: 'utf8' });
50
- console.log('generating update.rdf');
51
- template = fs.readFileSync(path.join(__dirname, 'update.rdf.pug'), 'utf8');
52
- template = pug.render(template, options_and_vars);
53
- fs.writeFileSync(path.join(root_1.default, 'gen/update.rdf'), template, { encoding: 'utf8' });
54
- console.log('generating updates.json');
55
- fs.writeFileSync(path.join(root_1.default, 'gen/updates.json'), JSON.stringify({
56
- addons: {
57
- [pkg.id]: {
58
- updates: [
59
- {
60
- version: options_and_vars.version,
61
- update_link: options_and_vars.updateLink,
62
- applications: {
63
- zotero: {
64
- strict_min_version: '6.999',
45
+ if (options_and_vars.minVersion.match(/^6/)) {
46
+ let template;
47
+ console.log('generating install.rdf');
48
+ template = fs.readFileSync(path.join(__dirname, 'install.rdf.pug'), 'utf8');
49
+ template = pug.render(template, options_and_vars);
50
+ fs.writeFileSync(path.join(root_1.default, 'build/install.rdf'), template, { encoding: 'utf8' });
51
+ console.log('generating update.rdf');
52
+ template = fs.readFileSync(path.join(__dirname, 'update.rdf.pug'), 'utf8');
53
+ template = pug.render(template, options_and_vars);
54
+ fs.writeFileSync(path.join(root_1.default, 'gen/update.rdf'), template, { encoding: 'utf8' });
55
+ }
56
+ if (options_and_vars.maxVersion.match(/^7/)) {
57
+ console.log('generating updates.json');
58
+ fs.writeFileSync(path.join(root_1.default, 'gen/updates.json'), JSON.stringify({
59
+ addons: {
60
+ [pkg.id]: {
61
+ updates: [
62
+ {
63
+ version: options_and_vars.version,
64
+ update_link: options_and_vars.updateLink,
65
+ applications: {
66
+ zotero: {
67
+ strict_min_version: '6.999',
68
+ },
65
69
  },
66
70
  },
67
- },
68
- ],
71
+ ],
72
+ },
69
73
  },
70
- },
71
- }, null, 2));
72
- const icons = [
73
- { 48: (_b = (_a = pkg.xpi) === null || _a === void 0 ? void 0 : _a.iconURL) === null || _b === void 0 ? void 0 : _b.replace(/^chrome:\/\/[^/]+\//, '') },
74
- ].filter(i => i[48]);
75
- const basename = pkg.id.replace(/@.*/, '');
76
- for (const i of [`content/skin/${basename}.png`, `skin/${basename}.png`, `${basename}.png`, 'icon.png']) {
77
- icons.push({ 48: i });
78
- icons.push({ 48: i.replace('/zotero-', '/') });
79
- }
80
- for (const i of [...icons]) {
81
- icons.push({ 48: i[48].replace(/[.](svg|png)$/, ext => ({ '.svg': '.png', '.png': '.svg' }[ext])) });
82
- }
83
- for (const i of [...icons]) {
84
- if (i[48].endsWith('.svg')) {
85
- i[96] = i[48];
74
+ }, null, 2));
75
+ const icons = [
76
+ { 48: (_b = (_a = pkg.xpi) === null || _a === void 0 ? void 0 : _a.iconURL) === null || _b === void 0 ? void 0 : _b.replace(/^chrome:\/\/[^/]+\//, '') },
77
+ ].filter(i => i[48]);
78
+ const basename = pkg.id.replace(/@.*/, '');
79
+ for (const i of [`content/skin/${basename}.png`, `skin/${basename}.png`, `${basename}.png`, 'icon.png']) {
80
+ icons.push({ 48: i });
81
+ icons.push({ 48: i.replace('/zotero-', '/') });
86
82
  }
87
- else {
88
- i[96] = i[48].replace(/([.][^.]+)$/, '@2x$1');
83
+ for (const i of [...icons]) {
84
+ icons.push({ 48: i[48].replace(/[.](svg|png)$/, ext => ({ '.svg': '.png', '.png': '.svg' }[ext])) });
89
85
  }
90
- }
91
- const icon = icons.find(i => fs.existsSync(path.join(root_1.default, ...i[48].split('/'))));
92
- if (icon) {
93
- options_and_vars.icons = {
94
- 48: icon[48],
95
- 96: fs.existsSync(path.join(root_1.default, ...icon[96].split('/'))) ? icon[96] : icon[48],
96
- };
97
- }
98
- console.log('generating manifest.json');
99
- fs.writeFileSync(path.join(root_1.default, 'build/manifest.json'), JSON.stringify({
100
- manifest_version: 2,
101
- name: options_and_vars.name,
102
- version: options_and_vars.version,
103
- description: options_and_vars.description,
104
- icons: options_and_vars.icons,
105
- applications: {
106
- zotero: {
107
- id: options_and_vars.id,
108
- update_url: options_and_vars.updateURL.replace('/update.rdf', '/updates.json'),
109
- strict_min_version: '6.999',
110
- strict_max_version: '7.*',
86
+ for (const i of [...icons]) {
87
+ if (i[48].endsWith('.svg')) {
88
+ i[96] = i[48];
89
+ }
90
+ else {
91
+ i[96] = i[48].replace(/([.][^.]+)$/, '@2x$1');
92
+ }
93
+ }
94
+ const icon = icons.find(i => fs.existsSync(path.join(root_1.default, ...i[48].split('/'))));
95
+ if (icon) {
96
+ options_and_vars.icons = {
97
+ 48: icon[48],
98
+ 96: fs.existsSync(path.join(root_1.default, ...icon[96].split('/'))) ? icon[96] : icon[48],
99
+ };
100
+ }
101
+ console.log('generating manifest.json');
102
+ fs.writeFileSync(path.join(root_1.default, 'build/manifest.json'), JSON.stringify({
103
+ manifest_version: 2,
104
+ name: options_and_vars.name,
105
+ version: options_and_vars.version,
106
+ description: options_and_vars.description,
107
+ icons: options_and_vars.icons,
108
+ applications: {
109
+ zotero: {
110
+ id: options_and_vars.id,
111
+ update_url: options_and_vars.updateURL.replace('/update.rdf', '/updates.json'),
112
+ strict_min_version: '6.999',
113
+ strict_max_version: '7.*',
114
+ },
111
115
  },
112
- },
113
- }, null, 2));
116
+ }, null, 2));
117
+ }
package/update.rdf.pug CHANGED
@@ -9,16 +9,16 @@ RDF:RDF(xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http:/
9
9
  em:targetApplication
10
10
  RDF:Description
11
11
  em:id zotero@chnm.gmu.edu
12
- em:minVersion 5.0
13
- em:maxVersion 6.0.*
12
+ em:minVersion= minVersion
13
+ em:maxVersion= maxVersion
14
14
  em:updateLink= updateLink
15
15
  if updateInfoURL
16
16
  em:updateInfoURL= updateInfoURL
17
17
  em:targetApplication
18
18
  RDF:Description
19
19
  em:id juris-m@juris-m.github.io
20
- em:minVersion 5.0
21
- em:maxVersion 6.0.*
20
+ em:minVersion= minVersion
21
+ em:maxVersion= maxVersion
22
22
  em:updateLink= updateLink
23
23
  if updateInfoURL
24
24
  em:updateInfoURL= updateInfoURL