zotero-plugin 1.2.0 → 1.2.3
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/README.md +17 -2
- package/bin/branches.js +2 -2
- package/bin/link.js +3 -3
- package/bin/release.js +5 -5
- package/bin/start.py +13 -18
- package/bin/zipup.js +5 -5
- package/continuous-integration.js +1 -1
- package/copy-assets.js +4 -4
- package/debug-log.js +7 -3
- package/loader/peggy.js +1 -1
- package/loader/wrap.js +2 -2
- package/make-dirs.js +4 -4
- package/package.json +8 -8
- package/rdf.js +6 -6
- package/version.js +4 -4
package/README.md
CHANGED
|
@@ -28,6 +28,21 @@ add `#<number>` to the commit message.
|
|
|
28
28
|
|
|
29
29
|
Release new versions by issuing `npm version <major|minor|patch>`.
|
|
30
30
|
|
|
31
|
+
# Allowing your user to send debug information
|
|
32
|
+
|
|
33
|
+
In your plugin, add `import { DebugLog } from 'zotero-plugin/debug-log'` to your startup file, then
|
|
34
|
+
after `Zotero.Schema.updateSchemaPromise` clears, call
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
DebugLog.register('your plugin name', ['extensions.zotero.<your plugin extension root>.'])
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
the array is a list of either full names of preferences you want to know about, or a name ending in `.` which means "all keys directly under this".
|
|
41
|
+
|
|
42
|
+
The Help menu will now have an entry "send debug log to file.io"; when your user selects that, the error log and the selected settings will be sent to file.io; if any items are selected, when that is clicked, a copy of those items will be included in RDF format.
|
|
43
|
+
|
|
44
|
+
The user will get an ID that looks like `C3WvhYgA8RDM-2XZGASLV`; the first part is the file.io ID, so you would go to `https://file.io/C3WvhYgA8RDM` to retrieve the download; the zipfile you get there will be `2XZGASLV.zip`.
|
|
45
|
+
|
|
31
46
|
# Starting Zotero with your plugin loaded
|
|
32
47
|
|
|
33
48
|
Note is is *much* adviced to create a separate Zotero profile for testing!
|
|
@@ -38,7 +53,7 @@ Create a file called `zotero-plugin.ini` with the following contents:
|
|
|
38
53
|
|
|
39
54
|
```
|
|
40
55
|
[profile]
|
|
41
|
-
name = <your test profile name>
|
|
56
|
+
name = <your test profile name> # optional. when not present, the profile picker will popup, where you can select the test profile
|
|
42
57
|
path = <your test profile absolute path>
|
|
43
58
|
|
|
44
59
|
[zotero]
|
|
@@ -61,7 +76,7 @@ and add this script to your package.json:
|
|
|
61
76
|
"start": "zotero-start"
|
|
62
77
|
```
|
|
63
78
|
|
|
64
|
-
then when you execute `npm start`, zotero will start up with the latest build of your plugin installed.
|
|
79
|
+
then when you execute `npm start`, zotero will start up with the latest build of your plugin installed, and the given preferences set.
|
|
65
80
|
|
|
66
81
|
**DO CREATE A BACKUP OF YOUR ZOTERO DATA *AND* YOUR ZOTERO PROFILE BEFORE USING THIS THE FIRST TIME**
|
|
67
82
|
|
package/bin/branches.js
CHANGED
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
process.on('unhandledRejection', up => { throw up; });
|
|
7
7
|
require("dotenv/config");
|
|
8
|
-
const path =
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
9
9
|
const rest_1 = require("@octokit/rest");
|
|
10
10
|
const octokit = new rest_1.Octokit({ auth: `token ${process.env.GITHUB_TOKEN}` });
|
|
11
|
-
const root_1 =
|
|
11
|
+
const root_1 = tslib_1.__importDefault(require("../root"));
|
|
12
12
|
const pkg = require(path.join(root_1.default, 'package.json'));
|
|
13
13
|
const [, owner, repo] = pkg.repository.url.match(/:\/\/github.com\/([^/]+)\/([^.]+)\.git$/);
|
|
14
14
|
async function main() {
|
package/bin/link.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call */
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const fs =
|
|
7
|
-
const path =
|
|
8
|
-
const root_1 =
|
|
6
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
const root_1 = tslib_1.__importDefault(require("../root"));
|
|
9
9
|
const pkg = Object.assign({}, require(path.join(root_1.default, 'package.json')));
|
|
10
10
|
if (!pkg.id)
|
|
11
11
|
pkg.id = `${pkg.name.replace(/^zotero-/, '')}@${pkg.author.email.replace(/.*@/, '')}`.toLowerCase();
|
package/bin/release.js
CHANGED
|
@@ -5,16 +5,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
process.on('unhandledRejection', up => { throw up; });
|
|
7
7
|
require("dotenv/config");
|
|
8
|
-
const path =
|
|
9
|
-
const moment_1 =
|
|
10
|
-
const fs =
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
9
|
+
const moment_1 = tslib_1.__importDefault(require("moment"));
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
11
11
|
const rest_1 = require("@octokit/rest");
|
|
12
12
|
const octokit = new rest_1.Octokit({ auth: `token ${process.env.GITHUB_TOKEN}` });
|
|
13
13
|
const continuous_integration_1 = require("../continuous-integration");
|
|
14
|
-
const root_1 =
|
|
14
|
+
const root_1 = tslib_1.__importDefault(require("../root"));
|
|
15
15
|
const pkg = require(path.join(root_1.default, 'package.json'));
|
|
16
16
|
const [, owner, repo] = pkg.repository.url.match(/:\/\/github.com\/([^/]+)\/([^.]+)\.git$/);
|
|
17
|
-
const version_1 =
|
|
17
|
+
const version_1 = tslib_1.__importDefault(require("../version"));
|
|
18
18
|
const xpi = `${pkg.name}-${version_1.default}.xpi`;
|
|
19
19
|
const PRERELEASE = false;
|
|
20
20
|
// eslint-disable-next-line no-magic-numbers
|
package/bin/start.py
CHANGED
|
@@ -140,30 +140,25 @@ for plugin_id in ET.parse(os.path.join(config.plugin.source, 'install.rdf')).get
|
|
|
140
140
|
plugin_path = os.path.join(config.profile.path, 'extensions', plugin_id.text)
|
|
141
141
|
with open(plugin_path, 'w') as f:
|
|
142
142
|
sources = config.plugin.source
|
|
143
|
-
if sources[-1]
|
|
143
|
+
if sources[-1] not in '/\\': sources += os.sep
|
|
144
144
|
|
|
145
145
|
if config.windows:
|
|
146
146
|
sources = sources.replace('\\', '\\\\').replace('/', '\\\\')
|
|
147
147
|
|
|
148
148
|
print('Writing addon source path to proxy file')
|
|
149
|
-
print('Source path:
|
|
150
|
-
print('Proxy file path:
|
|
149
|
+
print('Source path:', sources)
|
|
150
|
+
print('Proxy file path:', plugin_path)
|
|
151
151
|
|
|
152
152
|
print(sources, file=f)
|
|
153
153
|
|
|
154
|
-
cmd = [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
config.zotero.log,
|
|
165
|
-
'&',
|
|
166
|
-
]
|
|
167
|
-
if p is not None
|
|
168
|
-
]
|
|
154
|
+
cmd = filter(None, [
|
|
155
|
+
config.zotero.path,
|
|
156
|
+
'-purgecaches',
|
|
157
|
+
'-P', config.profile.name,
|
|
158
|
+
'-ZoteroDebug' if config.windows else '-ZoteroDebugText',
|
|
159
|
+
'-jsconsole',
|
|
160
|
+
'-datadir', 'profile',
|
|
161
|
+
config.zotero.log and '>', config.zotero.log,
|
|
162
|
+
'&',
|
|
163
|
+
])
|
|
169
164
|
system(subprocess.list2cmdline(cmd))
|
package/bin/zipup.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const fs =
|
|
7
|
-
const path =
|
|
8
|
-
const archiver =
|
|
9
|
-
const root_1 =
|
|
10
|
-
const version_1 =
|
|
6
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
const archiver = tslib_1.__importStar(require("archiver"));
|
|
9
|
+
const root_1 = tslib_1.__importDefault(require("../root"));
|
|
10
|
+
const version_1 = tslib_1.__importDefault(require("../version"));
|
|
11
11
|
const [, , source, target] = process.argv;
|
|
12
12
|
const xpi = path.join(root_1.default, 'xpi', `${target}-${version_1.default}.xpi`);
|
|
13
13
|
console.log(`creating ${xpi}`); // eslint-disable-line no-console
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContinuousIntegration = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const child_process =
|
|
5
|
+
const child_process = tslib_1.__importStar(require("child_process"));
|
|
6
6
|
class ContinuousIntegrationSingleton {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.service = '';
|
package/copy-assets.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* eslint-disable no-console, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs =
|
|
6
|
-
const glob =
|
|
7
|
-
const path =
|
|
8
|
-
const root_1 =
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const glob = tslib_1.__importStar(require("glob"));
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
const root_1 = tslib_1.__importDefault(require("./root"));
|
|
9
9
|
function include(file, sources) {
|
|
10
10
|
if (fs.lstatSync(file).isDirectory())
|
|
11
11
|
return false;
|
package/debug-log.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DebugLog = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const jszip_1 =
|
|
5
|
+
const jszip_1 = tslib_1.__importDefault(require("jszip"));
|
|
6
6
|
class DebugLogSender {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.enabled = false;
|
|
@@ -78,18 +78,22 @@ class DebugLogSender {
|
|
|
78
78
|
}
|
|
79
79
|
preferences(plugin) {
|
|
80
80
|
const prefs = {};
|
|
81
|
+
const names = [];
|
|
81
82
|
for (const pref of this.plugins[plugin] || []) {
|
|
82
83
|
if (pref.endsWith('.')) {
|
|
83
84
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
84
85
|
const childkeys = Services.prefs.getBranch(pref).getChildList('', {});
|
|
85
86
|
for (const key of childkeys) {
|
|
86
|
-
|
|
87
|
+
names.push(pref + key);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
else {
|
|
90
|
-
|
|
91
|
+
names.push(pref);
|
|
91
92
|
}
|
|
92
93
|
}
|
|
94
|
+
for (const pref of names.sort()) {
|
|
95
|
+
prefs[pref] = Zotero.Prefs.get(pref, true);
|
|
96
|
+
}
|
|
93
97
|
return prefs;
|
|
94
98
|
}
|
|
95
99
|
async post(url, data) {
|
package/loader/peggy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable prefer-arrow/prefer-arrow-functions, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const peggy =
|
|
4
|
+
const peggy = tslib_1.__importStar(require("peggy"));
|
|
5
5
|
module.exports = function loader(source) {
|
|
6
6
|
return peggy.generate(source, {
|
|
7
7
|
output: 'source',
|
package/loader/wrap.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable no-console, prefer-template, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path =
|
|
5
|
-
const root_1 =
|
|
4
|
+
const path = tslib_1.__importStar(require("path"));
|
|
5
|
+
const root_1 = tslib_1.__importDefault(require("../root"));
|
|
6
6
|
const pkg = Object.assign({}, require(path.join(root_1.default, 'package.json')));
|
|
7
7
|
module.exports = function loader(source) {
|
|
8
8
|
// this.cacheable()
|
package/make-dirs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* eslint-disable no-console, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const rimraf =
|
|
6
|
-
const fs =
|
|
7
|
-
const path =
|
|
8
|
-
const root_1 =
|
|
5
|
+
const rimraf = tslib_1.__importStar(require("rimraf"));
|
|
6
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
|
+
const root_1 = tslib_1.__importDefault(require("./root"));
|
|
9
9
|
console.log('make build dirs');
|
|
10
10
|
for (const dir of [path.join(root_1.default, 'build'), path.join(root_1.default, 'gen'), path.join(root_1.default, 'xpi')]) {
|
|
11
11
|
rimraf.sync(dir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Zotero plugin builder",
|
|
5
5
|
"homepage": "https://github.com/retorquere/zotero-plugin/wiki",
|
|
6
6
|
"bin": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@octokit/rest": "^18.12.0",
|
|
31
31
|
"@rgrove/parse-xml": "^3.0.0",
|
|
32
|
-
"@types/node": "^17.0.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
34
|
-
"@typescript-eslint/parser": "^5.
|
|
35
|
-
"@xmldom/xmldom": "^0.8.
|
|
32
|
+
"@types/node": "^17.0.21",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
34
|
+
"@typescript-eslint/parser": "^5.13.0",
|
|
35
|
+
"@xmldom/xmldom": "^0.8.1",
|
|
36
36
|
"ajv": "^8.10.0",
|
|
37
37
|
"ajv-keywords": "^5.1.0",
|
|
38
38
|
"archiver": "^5.3.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"current-git-branch": "^1.1.0",
|
|
41
41
|
"dotenv": "^16.0.0",
|
|
42
42
|
"ejs": "^3.1.6",
|
|
43
|
-
"eslint": "^8.
|
|
43
|
+
"eslint": "^8.10.0",
|
|
44
44
|
"eslint-plugin-import": "^2.25.4",
|
|
45
45
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
46
46
|
"glob": "^7.2.0",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"shell-quote": "^1.7.3",
|
|
56
56
|
"shelljs": "^0.8.5",
|
|
57
57
|
"string-to-arraybuffer": "^1.0.2",
|
|
58
|
-
"ts-node": "^10.
|
|
58
|
+
"ts-node": "^10.6.0",
|
|
59
59
|
"tslib": "^2.3.1",
|
|
60
|
-
"typescript": "^4.
|
|
60
|
+
"typescript": "^4.6.2",
|
|
61
61
|
"uri-templates": "^0.2.0",
|
|
62
62
|
"xml-parser": "^1.2.1",
|
|
63
63
|
"xpath": "^0.0.32"
|
package/rdf.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
/* eslint-disable no-console, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs =
|
|
6
|
-
const path =
|
|
7
|
-
const glob =
|
|
8
|
-
const pug =
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const glob = tslib_1.__importStar(require("glob"));
|
|
8
|
+
const pug = tslib_1.__importStar(require("pug"));
|
|
9
9
|
const PropertiesReader = require("properties-reader");
|
|
10
10
|
const uriTemplate = require("uri-templates");
|
|
11
|
-
const root_1 =
|
|
12
|
-
const version_1 =
|
|
11
|
+
const root_1 = tslib_1.__importDefault(require("./root"));
|
|
12
|
+
const version_1 = tslib_1.__importDefault(require("./version"));
|
|
13
13
|
const pkg = Object.assign({}, require(path.join(root_1.default, 'package.json')));
|
|
14
14
|
if (!pkg.id)
|
|
15
15
|
pkg.id = `${pkg.name.replace(/^zotero-/, '')}@${pkg.author.email.replace(/.*@/, '')}`.toLowerCase();
|
package/version.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path =
|
|
6
|
-
const os =
|
|
7
|
-
const fs =
|
|
8
|
-
const root_1 =
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
|
+
const os = tslib_1.__importStar(require("os"));
|
|
7
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
8
|
+
const root_1 = tslib_1.__importDefault(require("./root"));
|
|
9
9
|
const continuous_integration_1 = require("./continuous-integration");
|
|
10
10
|
let version = null;
|
|
11
11
|
const version_js = path.join(root_1.default, 'gen/version.js');
|