zotero-plugin-scaffold 0.2.0-beta.9 → 0.2.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/README.md +3 -160
- package/bin/zotero-plugin.mjs +5 -0
- package/dist/cli.d.mts +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +58 -48
- package/dist/index.d.mts +80 -34
- package/dist/index.d.ts +80 -34
- package/dist/index.mjs +6 -4
- package/dist/shared/{zotero-plugin-scaffold.2ad7a023.mjs → zotero-plugin-scaffold.DiPAIBFh.mjs} +1044 -644
- package/dist/shared/{zotero-plugin-scaffold.77c9802c.mjs → zotero-plugin-scaffold.v8dJZZ-v.mjs} +1 -3
- package/dist/vendor/index.mjs +1 -1
- package/package.json +20 -26
- package/dist/chunks/github.mjs +0 -200
package/README.md
CHANGED
|
@@ -1,167 +1,10 @@
|
|
|
1
1
|
# Zotero Plugin Development Scaffold
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/zotero-plugin-scaffold)
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-
[](https://github.com/antfu/eslint-config)
|
|
3
|
+
Delivering a modern and elegant development experience for Zotero plugins.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
## Documentation
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
This project is under active development, and some APIs may change. However, it is ready for production and has been [used in several projects](https://github.com/northword/zotero-plugin-scaffold/network/dependents).
|
|
14
|
-
|
|
15
|
-
For best practices regarding this package, please refer to [zotero-plugin-template](https://github.com/windingwind/zotero-plugin-template).
|
|
16
|
-
|
|
17
|
-
## Using in a blank project
|
|
18
|
-
|
|
19
|
-
<details>
|
|
20
|
-
|
|
21
|
-
<summary>WIP: Not yet implemented</summary>
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# npm
|
|
25
|
-
npx zotero-plugin create
|
|
26
|
-
# pnpm
|
|
27
|
-
pnpm dlx zotero-plugin create
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
</details>
|
|
31
|
-
|
|
32
|
-
## Using in an existing project
|
|
33
|
-
|
|
34
|
-
### 01. Install
|
|
35
|
-
|
|
36
|
-
#### From NPM
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install -D zotero-plugin-scaffold
|
|
40
|
-
|
|
41
|
-
yarn add -D zotero-plugin-scaffold
|
|
42
|
-
|
|
43
|
-
pnpm add -D zotero-plugin-scaffold
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
#### From source code
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# clone this repo
|
|
50
|
-
git clone https://github.com/northword/zotero-plugin-scaffold.git zotero-plugin-scaffold/
|
|
51
|
-
cd zotero-plugin-scaffold/
|
|
52
|
-
|
|
53
|
-
# build
|
|
54
|
-
pnpm install
|
|
55
|
-
pnpm build # or pnpm dev
|
|
56
|
-
|
|
57
|
-
# npm link
|
|
58
|
-
cd your-plugin-work-dir/
|
|
59
|
-
pnpm link ../zotero-plugin-scaffold
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### 02. Create a config file
|
|
63
|
-
|
|
64
|
-
The configuration file needs to be stored in the following location.
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
zotero-plugin.config.ts # also avaliable in *.js *.mjs *.cjs *.ts
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
You can import helper `defineConfig` to get type hints. If no value is specified for an optional property, the default value will be used.
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
import { defineConfig } from "zotero-plugin-scaffold";
|
|
74
|
-
|
|
75
|
-
export default defineConfig({
|
|
76
|
-
name: "the plugin name",
|
|
77
|
-
id: "the plugin id",
|
|
78
|
-
namespace: "the plugin namespace",
|
|
79
|
-
build: {
|
|
80
|
-
esbuildOptions: [
|
|
81
|
-
{
|
|
82
|
-
entryPoints: ["src/index.ts"],
|
|
83
|
-
bundle: true,
|
|
84
|
-
target: "firefox115",
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Full config please refrence in [src/types](./src/types/index.ts).
|
|
92
|
-
|
|
93
|
-
### 03. Create a env file
|
|
94
|
-
|
|
95
|
-
This file defines Zotero's runtime configuration such as binary paths, profile paths, and environment variables required for Node scripts to run.
|
|
96
|
-
|
|
97
|
-
NOTE: Do not check-in this file to the repository!
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
.env
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```ini
|
|
104
|
-
# The path of the Zotero binary file.
|
|
105
|
-
# The path is `*/Zotero.app/Contents/MacOS/zotero` for macOS.
|
|
106
|
-
ZOTERO_PLUGIN_ZOTERO_BIN_PATH = /path/to/zotero.exe
|
|
107
|
-
|
|
108
|
-
# The path of the profile used for development.
|
|
109
|
-
# Start the profile manager by `/path/to/zotero.exe -p` to create a profile for development.
|
|
110
|
-
# @see https://www.zotero.org/support/kb/profile_directory
|
|
111
|
-
ZOTERO_PLUGIN_PROFILE_PATH = /path/to/profile
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### 04. Add scripts to package.json
|
|
115
|
-
|
|
116
|
-
```json
|
|
117
|
-
{
|
|
118
|
-
"scripts": {
|
|
119
|
-
"start": "zotero-plugin serve",
|
|
120
|
-
"build": "zotero-plugin build",
|
|
121
|
-
"release": "zotero-plugin release"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 05. Run
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
pnpm run start
|
|
130
|
-
pnpm run build
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Using in NodeJS code
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
import { Build, Config } from "zotero-plugin-scaffold";
|
|
137
|
-
|
|
138
|
-
const config = await Config.loadConfig();
|
|
139
|
-
|
|
140
|
-
const Builder = new Build(config);
|
|
141
|
-
await Builder.run();
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Contributing
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
# Git Clone
|
|
148
|
-
git clone https://github.com/northword/zotero-plugin-scaffold.git zotero-plugin-scaffold
|
|
149
|
-
cd zotero-plugin-scaffold/
|
|
150
|
-
|
|
151
|
-
# Install deps
|
|
152
|
-
pnpm install
|
|
153
|
-
|
|
154
|
-
# Development Mode
|
|
155
|
-
# This command creates a typescript runtime using jiti,
|
|
156
|
-
# and the modified code does not need to be built again.
|
|
157
|
-
pnpm run dev
|
|
158
|
-
|
|
159
|
-
# Build
|
|
160
|
-
pnpm run build
|
|
161
|
-
|
|
162
|
-
# ES Lint
|
|
163
|
-
pnpm run lint:fix
|
|
164
|
-
```
|
|
7
|
+
[Read the Docs to Learn More](https://northword.github.io/zotero-plugin-scaffold).
|
|
165
8
|
|
|
166
9
|
## License
|
|
167
10
|
|
package/dist/cli.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function
|
|
1
|
+
declare function run(): Promise<void>;
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { run as default };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function
|
|
1
|
+
declare function run(): Promise<void>;
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { run as default };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import process, { exit, env } from 'node:process';
|
|
1
|
+
import process from 'node:process';
|
|
3
2
|
import { Command } from '@commander-js/extra-typings';
|
|
4
|
-
import {
|
|
3
|
+
import { E as ExitSignals, l as logger, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.DiPAIBFh.mjs';
|
|
4
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
|
+
import { pathExists, ensureFile } from 'fs-extra';
|
|
5
6
|
import tinyUpdateNotifier from 'tiny-update-notifier';
|
|
6
7
|
import 'c12';
|
|
7
8
|
import 'es-toolkit';
|
|
@@ -10,16 +11,17 @@ import 'hookable';
|
|
|
10
11
|
import 'node:readline';
|
|
11
12
|
import 'chalk';
|
|
12
13
|
import 'std-env';
|
|
13
|
-
import './shared/zotero-plugin-scaffold.
|
|
14
|
-
import 'node:fs/promises';
|
|
14
|
+
import './shared/zotero-plugin-scaffold.v8dJZZ-v.mjs';
|
|
15
15
|
import 'tinyglobby';
|
|
16
|
+
import 'node:fs';
|
|
16
17
|
import 'node:path';
|
|
17
18
|
import 'adm-zip';
|
|
18
19
|
import 'esbuild';
|
|
19
20
|
import 'node:crypto';
|
|
20
|
-
import '
|
|
21
|
+
import '@swc/core';
|
|
21
22
|
import 'node:child_process';
|
|
22
23
|
import 'bumpp';
|
|
24
|
+
import 'octokit';
|
|
23
25
|
import 'chokidar';
|
|
24
26
|
import 'node:net';
|
|
25
27
|
import 'node:buffer';
|
|
@@ -30,15 +32,16 @@ import 'xvfb-ts';
|
|
|
30
32
|
|
|
31
33
|
const name = "zotero-plugin-scaffold";
|
|
32
34
|
const type = "module";
|
|
33
|
-
const version = "0.2.
|
|
34
|
-
const packageManager = "pnpm@9.15.
|
|
35
|
+
const version = "0.2.1";
|
|
36
|
+
const packageManager = "pnpm@9.15.4";
|
|
35
37
|
const description = "A scaffold for Zotero plugin development.";
|
|
36
38
|
const author = "northword";
|
|
37
39
|
const license = "AGPL-3.0-or-later";
|
|
38
40
|
const homepage = "https://github.com/northword/zotero-plugin-scaffold#readme";
|
|
39
41
|
const repository = {
|
|
40
42
|
type: "git",
|
|
41
|
-
url: "https://github.com/northword/zotero-plugin-scaffold.git"
|
|
43
|
+
url: "https://github.com/northword/zotero-plugin-scaffold.git",
|
|
44
|
+
directory: "packages/scaffold"
|
|
42
45
|
};
|
|
43
46
|
const bugs = {
|
|
44
47
|
url: "https://github.com/northword/zotero-plugin-scaffold/issues"
|
|
@@ -55,6 +58,9 @@ const exports = {
|
|
|
55
58
|
types: "./dist/index.d.ts",
|
|
56
59
|
"import": "./dist/index.mjs"
|
|
57
60
|
},
|
|
61
|
+
"./cli": {
|
|
62
|
+
"import": "./dist/cli.mjs"
|
|
63
|
+
},
|
|
58
64
|
"./vendor": {
|
|
59
65
|
types: "./dist/vendor/index.d.ts",
|
|
60
66
|
"import": "./dist/vendor/index.mjs"
|
|
@@ -64,9 +70,10 @@ const main$1 = "./dist/index.mjs";
|
|
|
64
70
|
const module = "./dist/index.mjs";
|
|
65
71
|
const types = "./dist/index.d.ts";
|
|
66
72
|
const bin = {
|
|
67
|
-
"zotero-plugin": "./
|
|
73
|
+
"zotero-plugin": "./bin/zotero-plugin.mjs"
|
|
68
74
|
};
|
|
69
75
|
const files = [
|
|
76
|
+
"bin",
|
|
70
77
|
"dist"
|
|
71
78
|
];
|
|
72
79
|
const engines = {
|
|
@@ -75,10 +82,6 @@ const engines = {
|
|
|
75
82
|
const scripts = {
|
|
76
83
|
dev: "unbuild --stub",
|
|
77
84
|
build: "tsc --noEmit && unbuild",
|
|
78
|
-
"lint:check": "eslint .",
|
|
79
|
-
"lint:fix": "eslint . --fix",
|
|
80
|
-
release: "bumpp --commit \"chore(release): publish v%s\"",
|
|
81
|
-
"update:deps": "pnpx taze minor -w -f -l",
|
|
82
85
|
test: "echo \"Error: no test specified\" && exit 1"
|
|
83
86
|
};
|
|
84
87
|
const publishConfig = {
|
|
@@ -86,8 +89,7 @@ const publishConfig = {
|
|
|
86
89
|
registry: "https://registry.npmjs.org"
|
|
87
90
|
};
|
|
88
91
|
const directories = {
|
|
89
|
-
lib: "dist"
|
|
90
|
-
doc: "docs"
|
|
92
|
+
lib: "dist"
|
|
91
93
|
};
|
|
92
94
|
const peerDependencies = {
|
|
93
95
|
"conventional-changelog": "^6.0.0"
|
|
@@ -98,33 +100,27 @@ const peerDependenciesMeta = {
|
|
|
98
100
|
}
|
|
99
101
|
};
|
|
100
102
|
const dependencies = {
|
|
101
|
-
"@commander-js/extra-typings": "^
|
|
103
|
+
"@commander-js/extra-typings": "^13.1.0",
|
|
104
|
+
"@swc/core": "^1.10.12",
|
|
102
105
|
"adm-zip": "^0.5.16",
|
|
103
|
-
bumpp: "^
|
|
106
|
+
bumpp: "^10.0.1",
|
|
104
107
|
c12: "^2.0.1",
|
|
105
|
-
chalk: "^5.
|
|
106
|
-
chokidar: "^4.0.
|
|
107
|
-
commander: "^
|
|
108
|
-
"es-toolkit": "^1.
|
|
109
|
-
esbuild: "^0.24.
|
|
110
|
-
"fs-extra": "^11.
|
|
108
|
+
chalk: "^5.4.1",
|
|
109
|
+
chokidar: "^4.0.3",
|
|
110
|
+
commander: "^13.1.0",
|
|
111
|
+
"es-toolkit": "^1.32.0",
|
|
112
|
+
esbuild: "^0.24.2",
|
|
113
|
+
"fs-extra": "^11.3.0",
|
|
111
114
|
hookable: "^5.5.3",
|
|
112
|
-
|
|
113
|
-
octokit: "^4.0.2",
|
|
115
|
+
octokit: "^4.1.0",
|
|
114
116
|
"std-env": "^3.8.0",
|
|
115
117
|
"tiny-update-notifier": "^2.0.0",
|
|
116
118
|
tinyglobby: "^0.2.10",
|
|
117
119
|
"xvfb-ts": "^1.1.0"
|
|
118
120
|
};
|
|
119
121
|
const devDependencies = {
|
|
120
|
-
"@antfu/eslint-config": "^3.11.2",
|
|
121
122
|
"@types/adm-zip": "^0.5.7",
|
|
122
|
-
"@types/fs-extra": "^11.0.4"
|
|
123
|
-
"@types/node": "^22.10.2",
|
|
124
|
-
eslint: "^9.16.0",
|
|
125
|
-
"eslint-plugin-format": "^0.1.3",
|
|
126
|
-
typescript: "^5.7.2",
|
|
127
|
-
unbuild: "^2.0.0"
|
|
123
|
+
"@types/fs-extra": "^11.0.4"
|
|
128
124
|
};
|
|
129
125
|
const pkg = {
|
|
130
126
|
name: name,
|
|
@@ -154,31 +150,41 @@ const pkg = {
|
|
|
154
150
|
devDependencies: devDependencies
|
|
155
151
|
};
|
|
156
152
|
|
|
157
|
-
|
|
153
|
+
async function checkGitIgnore() {
|
|
154
|
+
if (!pathExists(".git"))
|
|
155
|
+
return;
|
|
156
|
+
await ensureFile(".gitignore");
|
|
157
|
+
const contents = (await readFile(".gitignore", "utf-8")).split("\n");
|
|
158
|
+
const ignores = ["node_modules", ".env", ".scaffold"];
|
|
159
|
+
ignores.forEach((ignore) => {
|
|
160
|
+
if (!contents.includes(ignore))
|
|
161
|
+
contents.push(ignore);
|
|
162
|
+
});
|
|
163
|
+
await writeFile(".gitignore", contents.join("\n"));
|
|
164
|
+
}
|
|
165
|
+
|
|
158
166
|
function updateNotifier(name, version) {
|
|
159
167
|
tinyUpdateNotifier({ pkg: { name, version } }).then((update) => {
|
|
160
168
|
if (update) {
|
|
161
169
|
const notify = () => {
|
|
162
|
-
logger
|
|
163
|
-
logger
|
|
164
|
-
logger
|
|
165
|
-
logger
|
|
170
|
+
logger.newLine();
|
|
171
|
+
logger.info(`New version of ${update.name} available!`);
|
|
172
|
+
logger.info(`Update: ${update.current} \u2192 ${update.latest} (${update.type})`);
|
|
173
|
+
logger.newLine();
|
|
166
174
|
};
|
|
167
175
|
ExitSignals.forEach((sig) => process.once(sig, notify));
|
|
168
176
|
}
|
|
169
177
|
}).catch();
|
|
170
178
|
}
|
|
171
179
|
|
|
172
|
-
const logger = new Log();
|
|
173
180
|
async function main() {
|
|
174
|
-
var _a;
|
|
175
181
|
const { name, version } = pkg;
|
|
176
182
|
updateNotifier(name, version);
|
|
177
|
-
|
|
183
|
+
process.env.NODE_ENV ??= "development";
|
|
178
184
|
const cli = new Command();
|
|
179
185
|
cli.version(version).usage("<command> [options]");
|
|
180
186
|
cli.command("build").description("Build the plugin").option("--dev", "Builds the plugin in dev mode").option("--dist <dir>", "The relative path for the new output directory (default: build)").action((options) => {
|
|
181
|
-
env.NODE_ENV = options.dev ? "development" : "production";
|
|
187
|
+
process.env.NODE_ENV = options.dev ? "development" : "production";
|
|
182
188
|
Config.loadConfig({
|
|
183
189
|
dist: options.dist
|
|
184
190
|
}).then((ctx) => new Build(ctx).run());
|
|
@@ -187,7 +193,7 @@ async function main() {
|
|
|
187
193
|
Config.loadConfig({}).then((ctx) => new Serve(ctx).run());
|
|
188
194
|
});
|
|
189
195
|
cli.command("test").description("Run tests").option("--abort-on-fail", "Abort the test suite on first failure").option("--exit-on-finish", "Exit the test suite after all tests have run").action((options) => {
|
|
190
|
-
env.NODE_ENV = "test";
|
|
196
|
+
process.env.NODE_ENV = "test";
|
|
191
197
|
Config.loadConfig({}).then((ctx) => {
|
|
192
198
|
if (options.abortOnFail) {
|
|
193
199
|
ctx.test.abortOnFail = true;
|
|
@@ -202,7 +208,7 @@ async function main() {
|
|
|
202
208
|
logger.error("The create not yet implemented");
|
|
203
209
|
});
|
|
204
210
|
cli.command("release").description("Release the plugin").argument("[version]", "Target version: major, minor, patch, pre*, or specify version").option("--preid <preid>", "ID for prerelease").option("-y, --yes", "Skip confirmation").action(async (version2, options) => {
|
|
205
|
-
env.NODE_ENV = "production";
|
|
211
|
+
process.env.NODE_ENV = "production";
|
|
206
212
|
Config.loadConfig({
|
|
207
213
|
release: {
|
|
208
214
|
bumpp: {
|
|
@@ -219,11 +225,15 @@ async function main() {
|
|
|
219
225
|
});
|
|
220
226
|
cli.parse();
|
|
221
227
|
}
|
|
222
|
-
|
|
223
|
-
|
|
228
|
+
async function run() {
|
|
229
|
+
main().then(() => {
|
|
230
|
+
checkGitIgnore();
|
|
231
|
+
}).catch(onError);
|
|
232
|
+
process.on("uncaughtException", onError);
|
|
233
|
+
}
|
|
224
234
|
function onError(err) {
|
|
225
235
|
logger.error(err);
|
|
226
|
-
exit(1);
|
|
236
|
+
process.exit(1);
|
|
227
237
|
}
|
|
228
238
|
|
|
229
|
-
export {
|
|
239
|
+
export { run as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,12 +2,27 @@ import { Hookable } from 'hookable';
|
|
|
2
2
|
import * as esbuild from 'esbuild';
|
|
3
3
|
import { BuildOptions } from 'esbuild';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Log level
|
|
7
|
+
*/
|
|
8
|
+
declare enum LOG_LEVEL {
|
|
9
|
+
trace = 0,
|
|
10
|
+
debug = 1,
|
|
11
|
+
info = 2,
|
|
12
|
+
warn = 3,
|
|
13
|
+
error = 4
|
|
14
|
+
}
|
|
15
|
+
type LogLevelType = keyof typeof LOG_LEVEL;
|
|
5
16
|
/**
|
|
6
17
|
* Logger
|
|
7
18
|
*/
|
|
8
19
|
declare class Log {
|
|
20
|
+
private static instance;
|
|
9
21
|
private logLevel;
|
|
10
|
-
constructor(
|
|
22
|
+
constructor(level?: LOG_LEVEL);
|
|
23
|
+
static getInstance(): Log;
|
|
24
|
+
setLogLevel(level: LogLevelType): void;
|
|
25
|
+
get level(): number;
|
|
11
26
|
private formatArgs;
|
|
12
27
|
private logArgs;
|
|
13
28
|
log(...args: any[]): void;
|
|
@@ -36,14 +51,9 @@ interface Manifest {
|
|
|
36
51
|
zotero: {
|
|
37
52
|
id: string;
|
|
38
53
|
update_url: string;
|
|
39
|
-
strict_min_version
|
|
54
|
+
strict_min_version?: string;
|
|
40
55
|
strict_max_version?: string;
|
|
41
56
|
};
|
|
42
|
-
gecko: {
|
|
43
|
-
id: string;
|
|
44
|
-
update_url: string;
|
|
45
|
-
strict_min_version: string;
|
|
46
|
-
};
|
|
47
57
|
};
|
|
48
58
|
}
|
|
49
59
|
|
|
@@ -66,7 +76,7 @@ interface UpdateJSON {
|
|
|
66
76
|
update_hash?: string;
|
|
67
77
|
applications: {
|
|
68
78
|
zotero: {
|
|
69
|
-
strict_min_version
|
|
79
|
+
strict_min_version?: string;
|
|
70
80
|
strict_max_version?: string;
|
|
71
81
|
};
|
|
72
82
|
[application: string]: {
|
|
@@ -221,7 +231,7 @@ interface Config$1 {
|
|
|
221
231
|
*
|
|
222
232
|
* @default "info"
|
|
223
233
|
*/
|
|
224
|
-
logLevel:
|
|
234
|
+
logLevel: LogLevelType;
|
|
225
235
|
}
|
|
226
236
|
interface BuildConfig {
|
|
227
237
|
/**
|
|
@@ -285,6 +295,48 @@ interface BuildConfig {
|
|
|
285
295
|
* @default true
|
|
286
296
|
*/
|
|
287
297
|
prefixFluentMessages: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Messages to ignore.
|
|
300
|
+
*
|
|
301
|
+
* 需要忽略的 Fluent Messages。
|
|
302
|
+
*
|
|
303
|
+
* @default []
|
|
304
|
+
*/
|
|
305
|
+
ignore: string[];
|
|
306
|
+
};
|
|
307
|
+
prefs: {
|
|
308
|
+
/**
|
|
309
|
+
* Prefixes the keys of preferences in `prefs.js` and
|
|
310
|
+
* the value of the `preference` attribute in XHTML files.
|
|
311
|
+
*
|
|
312
|
+
* 为 `prefs.js` 中的首选项键和 XHTML 文件中的 `preference` 属性的值
|
|
313
|
+
* 添加前缀。
|
|
314
|
+
*
|
|
315
|
+
* @default true
|
|
316
|
+
*/
|
|
317
|
+
prefixPrefKeys: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Prefixes for Preference Keys, no dot at the end.
|
|
320
|
+
*
|
|
321
|
+
* 首选项键的前缀,结尾不需要加点号。
|
|
322
|
+
*
|
|
323
|
+
* @default 'extensions.${namespace}'
|
|
324
|
+
*/
|
|
325
|
+
prefix: string;
|
|
326
|
+
/**
|
|
327
|
+
* Generate prefs.d.ts form prefs.js.
|
|
328
|
+
*
|
|
329
|
+
* - false: disable
|
|
330
|
+
* - string: path of dts file
|
|
331
|
+
*
|
|
332
|
+
* 为首选项生成类型声明文件。
|
|
333
|
+
*
|
|
334
|
+
* - false: 禁用
|
|
335
|
+
* - string:dts 文件路径
|
|
336
|
+
*
|
|
337
|
+
* @default 'typings/prefs.d.ts'
|
|
338
|
+
*/
|
|
339
|
+
dts: false | string;
|
|
288
340
|
};
|
|
289
341
|
/**
|
|
290
342
|
* Configurations of esbuild.
|
|
@@ -411,6 +463,8 @@ interface ServerConfig {
|
|
|
411
463
|
* @default false
|
|
412
464
|
*/
|
|
413
465
|
asProxy: boolean;
|
|
466
|
+
prebuild: boolean;
|
|
467
|
+
createProfileIfMissing: boolean;
|
|
414
468
|
/**
|
|
415
469
|
* The lifecycle hook.
|
|
416
470
|
*/
|
|
@@ -591,12 +645,6 @@ interface ReleaseConfig {
|
|
|
591
645
|
comment: boolean;
|
|
592
646
|
releaseNote: (ctx: Context) => string;
|
|
593
647
|
};
|
|
594
|
-
/**
|
|
595
|
-
* Release to Gitee
|
|
596
|
-
*
|
|
597
|
-
* @todo Not implemented yet
|
|
598
|
-
*/
|
|
599
|
-
gitee: ReleaseConfig["github"];
|
|
600
648
|
hooks: Partial<ReleaseHooks>;
|
|
601
649
|
}
|
|
602
650
|
interface ReleaseHooks {
|
|
@@ -635,14 +683,6 @@ interface TestConfig {
|
|
|
635
683
|
*/
|
|
636
684
|
timeout: number;
|
|
637
685
|
};
|
|
638
|
-
/**
|
|
639
|
-
* Port for the test server.
|
|
640
|
-
*
|
|
641
|
-
* 测试服务器的端口。
|
|
642
|
-
*
|
|
643
|
-
* @default 9876
|
|
644
|
-
*/
|
|
645
|
-
port: number;
|
|
646
686
|
/**
|
|
647
687
|
* Abort the test when the first test fails.
|
|
648
688
|
*
|
|
@@ -698,6 +738,10 @@ interface TestConfig {
|
|
|
698
738
|
* ```
|
|
699
739
|
*/
|
|
700
740
|
waitForPlugin: string;
|
|
741
|
+
/**
|
|
742
|
+
* @todo not
|
|
743
|
+
*/
|
|
744
|
+
watch: boolean;
|
|
701
745
|
hooks: Partial<TestHooks>;
|
|
702
746
|
}
|
|
703
747
|
interface TestHooks {
|
|
@@ -715,6 +759,7 @@ interface Hooks extends BuildHooks, ServeHooks, ReleaseHooks, TestHooks {
|
|
|
715
759
|
type RecursivePartial<T> = {
|
|
716
760
|
[P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
717
761
|
};
|
|
762
|
+
|
|
718
763
|
/**
|
|
719
764
|
* User config
|
|
720
765
|
*/
|
|
@@ -778,6 +823,7 @@ declare class Build extends Base {
|
|
|
778
823
|
*/
|
|
779
824
|
makeManifest(): Promise<void>;
|
|
780
825
|
prepareLocaleFiles(): Promise<void>;
|
|
826
|
+
preparePrefs(): Promise<void>;
|
|
781
827
|
esbuild(): Promise<esbuild.BuildResult<esbuild.BuildOptions>[]> | undefined;
|
|
782
828
|
makeUpdateJson(): Promise<void>;
|
|
783
829
|
pack(): Promise<void>;
|
|
@@ -805,7 +851,6 @@ declare class Serve extends Base {
|
|
|
805
851
|
private builder;
|
|
806
852
|
private runner?;
|
|
807
853
|
private _zoteroBinPath?;
|
|
808
|
-
private _profilePath?;
|
|
809
854
|
constructor(ctx: Context);
|
|
810
855
|
run(): Promise<void>;
|
|
811
856
|
/**
|
|
@@ -817,22 +862,21 @@ declare class Serve extends Base {
|
|
|
817
862
|
exit: () => never;
|
|
818
863
|
private onZoteroExit;
|
|
819
864
|
get zoteroBinPath(): string;
|
|
820
|
-
get profilePath(): string;
|
|
821
|
-
get dataDir(): string;
|
|
865
|
+
get profilePath(): string | undefined;
|
|
866
|
+
get dataDir(): string | undefined;
|
|
822
867
|
}
|
|
823
868
|
|
|
824
869
|
declare class Test extends Base {
|
|
825
870
|
private builder;
|
|
826
871
|
private runner?;
|
|
827
|
-
private
|
|
872
|
+
private communicator;
|
|
828
873
|
constructor(ctx: Context);
|
|
829
874
|
run(): Promise<void>;
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
createTestResources(): Promise<void>;
|
|
875
|
+
createTestPlugin(): Promise<void>;
|
|
876
|
+
copyTestLibraries(): Promise<void>;
|
|
833
877
|
bundleTests(): Promise<void>;
|
|
834
|
-
|
|
835
|
-
|
|
878
|
+
startHttpServer(): Promise<void>;
|
|
879
|
+
onHttpDataUpdated(body: {
|
|
836
880
|
type: "start" | "suite" | "suite end" | "pending" | "pass" | "fail" | "end" | "debug";
|
|
837
881
|
data?: {
|
|
838
882
|
title: string;
|
|
@@ -841,14 +885,16 @@ declare class Test extends Base {
|
|
|
841
885
|
stack?: string;
|
|
842
886
|
};
|
|
843
887
|
}): Promise<void>;
|
|
888
|
+
watch(): Promise<void>;
|
|
889
|
+
onCodeChanged(_path: string): Promise<void>;
|
|
844
890
|
startZoteroHeadless(): Promise<void>;
|
|
845
891
|
startZotero(): Promise<void>;
|
|
846
|
-
exit
|
|
892
|
+
private exit;
|
|
847
893
|
private get zoteroBinPath();
|
|
848
894
|
private get profilePath();
|
|
849
895
|
private get dataDir();
|
|
850
|
-
private get testBuildDir();
|
|
851
896
|
private get testPluginDir();
|
|
897
|
+
private get cacheDir();
|
|
852
898
|
private get testPluginRef();
|
|
853
899
|
private get testPluginID();
|
|
854
900
|
private get prefs();
|