zotero-plugin-scaffold 0.2.11 → 0.3.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/dist/cli.mjs +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{zotero-plugin-scaffold.Cogc0b_B.mjs → zotero-plugin-scaffold.DWzaUAX4.mjs} +27 -19
- package/package.json +7 -7
- package/dist/cli.d.ts +0 -3
- package/dist/index.d.ts +0 -931
- package/dist/vendor/index.d.ts +0 -14
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { Command } from 'commander';
|
|
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.
|
|
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.DWzaUAX4.mjs';
|
|
4
4
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
5
|
import { pathExists, ensureFile } from 'fs-extra';
|
|
6
6
|
import tinyUpdateNotifier from 'tiny-update-notifier';
|
|
@@ -9,7 +9,7 @@ import 'es-toolkit';
|
|
|
9
9
|
import 'fs-extra/esm';
|
|
10
10
|
import 'hookable';
|
|
11
11
|
import 'node:readline';
|
|
12
|
-
import '
|
|
12
|
+
import 'node:util';
|
|
13
13
|
import 'std-env';
|
|
14
14
|
import './shared/zotero-plugin-scaffold.v8dJZZ-v.mjs';
|
|
15
15
|
import 'tinyglobby';
|
|
@@ -31,7 +31,7 @@ import 'node:http';
|
|
|
31
31
|
import 'xvfb-ts';
|
|
32
32
|
|
|
33
33
|
const name = "zotero-plugin-scaffold";
|
|
34
|
-
const version = "0.
|
|
34
|
+
const version = "0.3.0";
|
|
35
35
|
const pkg = {
|
|
36
36
|
name: name,
|
|
37
37
|
version: version};
|
package/dist/index.d.mts
CHANGED
|
@@ -44,7 +44,7 @@ declare class Logger {
|
|
|
44
44
|
debug(content: unknown, options?: LoggerOptions): void;
|
|
45
45
|
success(content: unknown, options?: LoggerOptions): void;
|
|
46
46
|
fail(content: unknown, options?: LoggerOptions): void;
|
|
47
|
-
ready(content:
|
|
47
|
+
ready(content: string): void;
|
|
48
48
|
clear(): void;
|
|
49
49
|
newLine(): void;
|
|
50
50
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.
|
|
1
|
+
export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.DWzaUAX4.mjs';
|
|
2
2
|
import 'c12';
|
|
3
3
|
import 'es-toolkit';
|
|
4
4
|
import 'fs-extra/esm';
|
|
5
5
|
import 'hookable';
|
|
6
6
|
import 'node:process';
|
|
7
7
|
import 'node:readline';
|
|
8
|
-
import '
|
|
8
|
+
import 'node:util';
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import './shared/zotero-plugin-scaffold.v8dJZZ-v.mjs';
|
|
11
11
|
import 'node:fs/promises';
|
package/dist/shared/{zotero-plugin-scaffold.Cogc0b_B.mjs → zotero-plugin-scaffold.DWzaUAX4.mjs}
RENAMED
|
@@ -4,7 +4,7 @@ import { readJsonSync, outputFile, emptyDir, copy, readJSON, outputJSON, move, w
|
|
|
4
4
|
import { createHooks } from 'hookable';
|
|
5
5
|
import process from 'node:process';
|
|
6
6
|
import readline from 'node:readline';
|
|
7
|
-
import
|
|
7
|
+
import util from 'node:util';
|
|
8
8
|
import { isDebug, isCI, isWindows, isMacOS, isLinux } from 'std-env';
|
|
9
9
|
import { p as parseRepoUrl, d as dateFormat, t as template, b as toArray, a as replaceInFile } from './zotero-plugin-scaffold.v8dJZZ-v.mjs';
|
|
10
10
|
import { createReadStream, existsSync } from 'node:fs';
|
|
@@ -26,6 +26,14 @@ import EventEmitter from 'node:events';
|
|
|
26
26
|
import http from 'node:http';
|
|
27
27
|
import { Xvfb } from 'xvfb-ts';
|
|
28
28
|
|
|
29
|
+
const factory = (...formats) =>
|
|
30
|
+
new Proxy(util.styleText.bind(util, formats), {
|
|
31
|
+
get: (_, format) =>
|
|
32
|
+
util.inspect.colors[format] && factory(...formats, format),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const styleText = factory();
|
|
36
|
+
|
|
29
37
|
var LOG_LEVEL = /* @__PURE__ */ ((LOG_LEVEL2) => {
|
|
30
38
|
LOG_LEVEL2[LOG_LEVEL2["TRACE"] = 0] = "TRACE";
|
|
31
39
|
LOG_LEVEL2[LOG_LEVEL2["DEBUG"] = 1] = "DEBUG";
|
|
@@ -35,13 +43,13 @@ var LOG_LEVEL = /* @__PURE__ */ ((LOG_LEVEL2) => {
|
|
|
35
43
|
return LOG_LEVEL2;
|
|
36
44
|
})(LOG_LEVEL || {});
|
|
37
45
|
const SYMBOLS = {
|
|
38
|
-
SUCCESS:
|
|
39
|
-
INFO:
|
|
40
|
-
FAIL:
|
|
41
|
-
TIP:
|
|
42
|
-
ERROR:
|
|
43
|
-
WARN:
|
|
44
|
-
DEBUG:
|
|
46
|
+
SUCCESS: styleText.green("\u2714"),
|
|
47
|
+
INFO: styleText.blue("\u2139"),
|
|
48
|
+
FAIL: styleText.red("\u2716"),
|
|
49
|
+
TIP: styleText.blue("\u2192"),
|
|
50
|
+
ERROR: styleText.bgRed(" ERROR "),
|
|
51
|
+
WARN: styleText.bgYellow(" WARN "),
|
|
52
|
+
DEBUG: styleText.grey("\u2699")};
|
|
45
53
|
const DEFAULT_OPTIONS = {
|
|
46
54
|
SPACE: 0,
|
|
47
55
|
NEW_LINE: false
|
|
@@ -118,7 +126,7 @@ class Logger {
|
|
|
118
126
|
return String(content);
|
|
119
127
|
}
|
|
120
128
|
formatError(error) {
|
|
121
|
-
return `${
|
|
129
|
+
return `${styleText.red(error.name)}: ${styleText.red(error.message)}
|
|
122
130
|
${error.stack}`;
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
@@ -163,7 +171,7 @@ ${error.stack}`;
|
|
|
163
171
|
this.logInternal(content, LOG_METHODS_CONFIG.fail, options);
|
|
164
172
|
}
|
|
165
173
|
ready(content) {
|
|
166
|
-
this.logInternal(
|
|
174
|
+
this.logInternal(styleText.green(content), LOG_METHODS_CONFIG.success);
|
|
167
175
|
}
|
|
168
176
|
clear() {
|
|
169
177
|
const blank = process.stdout.rows > 2 ? "\n".repeat(process.stdout.rows - 2) : "";
|
|
@@ -540,7 +548,7 @@ class Build extends Base {
|
|
|
540
548
|
const t = /* @__PURE__ */ new Date();
|
|
541
549
|
this.buildTime = dateFormat("YYYY-mm-dd HH:MM:SS", t);
|
|
542
550
|
this.logger.info(
|
|
543
|
-
`Building version ${
|
|
551
|
+
`Building version ${styleText.blue(version)} to ${styleText.blue(dist)} at ${styleText.blue(this.buildTime)} in ${styleText.blue(process.env.NODE_ENV)} mode.`
|
|
544
552
|
);
|
|
545
553
|
await this.ctx.hooks.callHook("build:init", this.ctx);
|
|
546
554
|
await emptyDir(dist);
|
|
@@ -671,13 +679,13 @@ class Build extends Base {
|
|
|
671
679
|
continue;
|
|
672
680
|
}
|
|
673
681
|
if (!allMessages.has(attrVal)) {
|
|
674
|
-
this.logger.warn(`HTML data-i10n-id '${
|
|
682
|
+
this.logger.warn(`HTML data-i10n-id '${styleText.blue(attrVal)}' in ${styleText.gray(htmlPath)} do not exist in any FTL message, skip to namespace it.`);
|
|
675
683
|
continue;
|
|
676
684
|
}
|
|
677
685
|
messagesInHTML.add(attrVal);
|
|
678
686
|
const namespacedAttr = `${namespace}-${attrVal}`;
|
|
679
687
|
htmlContent = htmlContent.replace(matched, `${attrKey}="${namespacedAttr}"`);
|
|
680
|
-
this.logger.debug(`HTML data-i10n-id '${
|
|
688
|
+
this.logger.debug(`HTML data-i10n-id '${styleText.blue(attrVal)}' in ${styleText.gray(htmlPath)} is namespaced to ${styleText.blue(namespacedAttr)}.`);
|
|
681
689
|
}
|
|
682
690
|
if (build.fluent.prefixFluentMessages)
|
|
683
691
|
await writeFile(htmlPath, htmlContent);
|
|
@@ -687,7 +695,7 @@ class Build extends Base {
|
|
|
687
695
|
return;
|
|
688
696
|
const missingLocales = [...messagesByLocale.entries()].filter(([_, messages]) => !messages.has(messageInHTML)).map(([locale]) => locale);
|
|
689
697
|
if (missingLocales.length > 0) {
|
|
690
|
-
this.logger.warn(`HTML data-l10n-id '${
|
|
698
|
+
this.logger.warn(`HTML data-l10n-id '${styleText.blue(messageInHTML)}' is missing in locales: ${missingLocales.join(", ")}.`);
|
|
691
699
|
}
|
|
692
700
|
});
|
|
693
701
|
}
|
|
@@ -721,17 +729,17 @@ class Build extends Base {
|
|
|
721
729
|
for (const match of matchs) {
|
|
722
730
|
const [matched, key] = match;
|
|
723
731
|
if (key.startsWith(prefix)) {
|
|
724
|
-
this.logger.debug(`Pref key '${
|
|
732
|
+
this.logger.debug(`Pref key '${styleText.blue(key)}' is already starts with '${prefix}', skip prefixing it.`);
|
|
725
733
|
continue;
|
|
726
734
|
} else if (key.startsWith("extensions.")) {
|
|
727
|
-
this.logger.warn(`Pref key '${
|
|
735
|
+
this.logger.warn(`Pref key '${styleText.blue(key)}' in ${styleText.gray(path)} starts with 'extensions.' but not '${styleText.blue(prefix)}', skip prefixing it.`);
|
|
728
736
|
continue;
|
|
729
737
|
} else if (!(key in prefsWithPrefix) && !(key in prefsWithoutPrefix)) {
|
|
730
|
-
this.logger.warn(`Pref key '${
|
|
738
|
+
this.logger.warn(`Pref key '${styleText.blue(key)}' in ${styleText.gray(path)} is not found in prefs.js, skip prefixing it.`);
|
|
731
739
|
continue;
|
|
732
740
|
} else {
|
|
733
741
|
const prefixed = `${prefix}.${key}`;
|
|
734
|
-
this.logger.debug(`Pref key '${
|
|
742
|
+
this.logger.debug(`Pref key '${styleText.blue(key)}' in ${styleText.gray(path)} is prefixed to ${styleText.blue(prefixed)}.`);
|
|
735
743
|
content = content.replace(matched, `preference="${prefixed}"`);
|
|
736
744
|
}
|
|
737
745
|
}
|
|
@@ -1087,7 +1095,7 @@ class Release extends Base {
|
|
|
1087
1095
|
conventionalChangelog({ releaseCount: 2, preset: "angular" }, { version }).on("data", (chunk) => {
|
|
1088
1096
|
changelog += chunk.toString();
|
|
1089
1097
|
}).on("end", () => {
|
|
1090
|
-
changelog = changelog.split("\n").filter((line) => !line.match(/^## .*/)).join("\n").trim();
|
|
1098
|
+
changelog = changelog.split("\n").filter((line) => !line.match(/^## .*/) || !line.match(/^# .*/)).join("\n").trim();
|
|
1091
1099
|
resolve(changelog);
|
|
1092
1100
|
}).on("error", (err) => {
|
|
1093
1101
|
reject(err);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin-scaffold",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"description": "A scaffold for Zotero plugin development.",
|
|
6
6
|
"author": "northword",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
],
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"types": "./dist/index.d.
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
27
|
"import": "./dist/index.mjs"
|
|
28
28
|
},
|
|
29
29
|
"./cli": {
|
|
30
30
|
"import": "./dist/cli.mjs"
|
|
31
31
|
},
|
|
32
32
|
"./vendor": {
|
|
33
|
-
"types": "./dist/vendor/index.d.
|
|
33
|
+
"types": "./dist/vendor/index.d.mts",
|
|
34
34
|
"import": "./dist/vendor/index.mjs"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"main": "./dist/index.mjs",
|
|
38
38
|
"module": "./dist/index.mjs",
|
|
39
|
-
"types": "./dist/index.d.
|
|
39
|
+
"types": "./dist/index.d.mts",
|
|
40
40
|
"bin": {
|
|
41
41
|
"zotero-plugin": "./bin/zotero-plugin.mjs"
|
|
42
42
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=
|
|
48
|
+
"node": ">=22.8.0"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public",
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"adm-zip": "^0.5.16",
|
|
68
68
|
"bumpp": "^10.0.3",
|
|
69
69
|
"c12": "^3.0.2",
|
|
70
|
-
"chalk": "^5.4.1",
|
|
71
70
|
"chokidar": "^4.0.3",
|
|
72
71
|
"commander": "^13.1.0",
|
|
73
72
|
"es-toolkit": "^1.32.0",
|
|
@@ -83,7 +82,8 @@
|
|
|
83
82
|
"devDependencies": {
|
|
84
83
|
"@commander-js/extra-typings": "^13.1.0",
|
|
85
84
|
"@types/adm-zip": "^0.5.7",
|
|
86
|
-
"@types/fs-extra": "^11.0.4"
|
|
85
|
+
"@types/fs-extra": "^11.0.4",
|
|
86
|
+
"node-style-text": "^0.0.7"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
89
|
"dev": "unbuild --stub",
|
package/dist/cli.d.ts
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,931 +0,0 @@
|
|
|
1
|
-
import { Hookable } from 'hookable';
|
|
2
|
-
import * as esbuild from 'esbuild';
|
|
3
|
-
import { BuildOptions } from 'esbuild';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Log level enumeration
|
|
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;
|
|
16
|
-
interface LoggerOptions {
|
|
17
|
-
space?: number;
|
|
18
|
-
newLine?: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare class Logger {
|
|
21
|
-
private static instance;
|
|
22
|
-
private currentLogLevel;
|
|
23
|
-
private constructor();
|
|
24
|
-
/**
|
|
25
|
-
* Determine the appropriate log level
|
|
26
|
-
*/
|
|
27
|
-
private determineLogLevel;
|
|
28
|
-
static getInstance(): Logger;
|
|
29
|
-
setLogLevel(level: LogLevelType): void;
|
|
30
|
-
get level(): LOG_LEVEL;
|
|
31
|
-
/**
|
|
32
|
-
* Generic log formatting logic
|
|
33
|
-
*/
|
|
34
|
-
private formatContent;
|
|
35
|
-
private formatError;
|
|
36
|
-
/**
|
|
37
|
-
* Core logging method
|
|
38
|
-
*/
|
|
39
|
-
private logInternal;
|
|
40
|
-
error(content: unknown, options?: LoggerOptions): void;
|
|
41
|
-
warn(content: unknown, options?: LoggerOptions): void;
|
|
42
|
-
tip(content: unknown, options?: LoggerOptions): void;
|
|
43
|
-
info(content: unknown, options?: LoggerOptions): void;
|
|
44
|
-
debug(content: unknown, options?: LoggerOptions): void;
|
|
45
|
-
success(content: unknown, options?: LoggerOptions): void;
|
|
46
|
-
fail(content: unknown, options?: LoggerOptions): void;
|
|
47
|
-
ready(content: unknown): void;
|
|
48
|
-
clear(): void;
|
|
49
|
-
newLine(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Direct passthrough to console.log
|
|
52
|
-
*/
|
|
53
|
-
log(content: unknown): void;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface Manifest {
|
|
57
|
-
[key: string]: any;
|
|
58
|
-
manifest_version: number;
|
|
59
|
-
name: string;
|
|
60
|
-
version: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
homepage_url?: string;
|
|
63
|
-
author?: string;
|
|
64
|
-
icons?: Record<string, string>;
|
|
65
|
-
applications: {
|
|
66
|
-
zotero: {
|
|
67
|
-
id: string;
|
|
68
|
-
update_url: string;
|
|
69
|
-
strict_min_version?: string;
|
|
70
|
-
strict_max_version?: string;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Update json
|
|
77
|
-
* @see https://extensionworkshop.com/documentation/manage/updating-your-extension/
|
|
78
|
-
*/
|
|
79
|
-
interface UpdateJSON {
|
|
80
|
-
addons: {
|
|
81
|
-
[addonID: string]: {
|
|
82
|
-
updates: Array<{
|
|
83
|
-
version: string;
|
|
84
|
-
update_link?: string;
|
|
85
|
-
/**
|
|
86
|
-
* A cryptographic hash of the file pointed to by `update_link`.
|
|
87
|
-
* This must be provided if `update_link` is not a secure URL.
|
|
88
|
-
* If present, this must be a string beginning with either `sha256:` or `sha512:`,
|
|
89
|
-
* followed by the hexadecimal-encoded hash of the matching type.
|
|
90
|
-
*/
|
|
91
|
-
update_hash?: string;
|
|
92
|
-
applications: {
|
|
93
|
-
zotero: {
|
|
94
|
-
strict_min_version?: string;
|
|
95
|
-
strict_max_version?: string;
|
|
96
|
-
};
|
|
97
|
-
[application: string]: {
|
|
98
|
-
strict_min_version?: string;
|
|
99
|
-
strict_max_version?: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
}>;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface Config$1 {
|
|
108
|
-
/**
|
|
109
|
-
* The source code directories.
|
|
110
|
-
*
|
|
111
|
-
* Can be multiple directories, and changes to these directories will be watched when `server` is running.
|
|
112
|
-
*
|
|
113
|
-
* 源码目录。
|
|
114
|
-
*
|
|
115
|
-
* 可以是多个目录,将在 `server` 运行时监听这些目录的变更。
|
|
116
|
-
*
|
|
117
|
-
* @default "src"
|
|
118
|
-
*/
|
|
119
|
-
source: string | string[];
|
|
120
|
-
/**
|
|
121
|
-
* The build directories.
|
|
122
|
-
*
|
|
123
|
-
* Scaffold will store the code before packaging after the build at `${dist}/addon`.
|
|
124
|
-
* Store the packaging results at `${dist}/${package_json.name}.xpi`.
|
|
125
|
-
*
|
|
126
|
-
* 构建目录。
|
|
127
|
-
*
|
|
128
|
-
* 脚手架将在 `${dist}/addon` 存放构建后打包前的代码。
|
|
129
|
-
* 在 `${dist}/${xpiName}.xpi` 存放打包结果。
|
|
130
|
-
*
|
|
131
|
-
* @default ".scaffold/build"
|
|
132
|
-
*/
|
|
133
|
-
dist: string;
|
|
134
|
-
/**
|
|
135
|
-
* The name of plugin.
|
|
136
|
-
*
|
|
137
|
-
* 插件名。
|
|
138
|
-
*
|
|
139
|
-
* @default package-json.name
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
name: string;
|
|
143
|
-
/**
|
|
144
|
-
* The ID of plugin.
|
|
145
|
-
*
|
|
146
|
-
* Usually in the form of an email address or UUID.
|
|
147
|
-
*
|
|
148
|
-
* 插件 ID。
|
|
149
|
-
*
|
|
150
|
-
* 通常是邮箱地址或UUID的形式。
|
|
151
|
-
*
|
|
152
|
-
* @default package-json.name
|
|
153
|
-
*/
|
|
154
|
-
id: string;
|
|
155
|
-
/**
|
|
156
|
-
* namespace of plugin.
|
|
157
|
-
*
|
|
158
|
-
* This attribute is also used to prevent plugin conflicts,
|
|
159
|
-
* it may be used for plugin HTML element ids, preference prefixes,
|
|
160
|
-
* fluent filename prefixes, fluent message prefixes, etc.
|
|
161
|
-
*
|
|
162
|
-
* Unlike the plugin id, this value should be HTML ID and Fluent Message compliant,
|
|
163
|
-
* i.e.: contain at least one character and only letters and dashes.
|
|
164
|
-
*
|
|
165
|
-
* 插件命名空间。
|
|
166
|
-
*
|
|
167
|
-
* 这个属性也用于防止插件冲突,它可能被用于插件的 HTML 元素 id,
|
|
168
|
-
* 首选项前缀,Fluent 文件名前缀、Fluent message 前缀等。
|
|
169
|
-
*
|
|
170
|
-
* 与插件 ID 不同的是,这个值应是符合 HTML ID 和 Fluent Message 规范的,
|
|
171
|
-
* 即:至少包含一个字符,仅包含字母和短横线。
|
|
172
|
-
*
|
|
173
|
-
* @default kebabCase(name)
|
|
174
|
-
*/
|
|
175
|
-
namespace: string;
|
|
176
|
-
/**
|
|
177
|
-
* XPI filename.
|
|
178
|
-
*
|
|
179
|
-
* XPI 文件名。
|
|
180
|
-
*
|
|
181
|
-
* @default kebabCase(name)
|
|
182
|
-
*/
|
|
183
|
-
xpiName: string;
|
|
184
|
-
/**
|
|
185
|
-
* The download link of XPI.
|
|
186
|
-
*
|
|
187
|
-
* Some placeholders are available, see Context.templateData.
|
|
188
|
-
*
|
|
189
|
-
* XPI 文件的地址。
|
|
190
|
-
*
|
|
191
|
-
* 一些可用的占位符请参阅 Context.templateData。
|
|
192
|
-
*
|
|
193
|
-
* @default `https://github.com/{{owner}}/{{repo}}/release/download/v{{version}}/{{xpiName}}.xpi`
|
|
194
|
-
*
|
|
195
|
-
* @see {@link Context.templateData}
|
|
196
|
-
*/
|
|
197
|
-
xpiDownloadLink: string;
|
|
198
|
-
/**
|
|
199
|
-
* The uri of update.json.
|
|
200
|
-
*
|
|
201
|
-
* Some placeholders are available, see Context.templateData.
|
|
202
|
-
*
|
|
203
|
-
* update.json 文件的地址。
|
|
204
|
-
*
|
|
205
|
-
* 一些可用的占位符请参阅 Context.templateData。
|
|
206
|
-
*
|
|
207
|
-
* @default `https://github.com/{{owner}}/{{repo}}/releaser/download/release/{{updateJson}}`
|
|
208
|
-
*
|
|
209
|
-
* @see {@link Context.templateData}
|
|
210
|
-
*/
|
|
211
|
-
updateURL: string;
|
|
212
|
-
/**
|
|
213
|
-
* Configurations required to run the build.
|
|
214
|
-
*
|
|
215
|
-
* 构建所需的配置。
|
|
216
|
-
*/
|
|
217
|
-
build: BuildConfig;
|
|
218
|
-
/**
|
|
219
|
-
* Configurations required to run the server.
|
|
220
|
-
*
|
|
221
|
-
* serve 所需的配置。
|
|
222
|
-
*/
|
|
223
|
-
server: ServerConfig;
|
|
224
|
-
/**
|
|
225
|
-
* @todo Use addonLint package to lint XPI.
|
|
226
|
-
*/
|
|
227
|
-
addonLint: object;
|
|
228
|
-
/**
|
|
229
|
-
* Configurations required to run the release.
|
|
230
|
-
*
|
|
231
|
-
* 发布相关配置。
|
|
232
|
-
*/
|
|
233
|
-
release: ReleaseConfig;
|
|
234
|
-
/**
|
|
235
|
-
* Configurations required to run the test.
|
|
236
|
-
*
|
|
237
|
-
* 测试相关配置。
|
|
238
|
-
*
|
|
239
|
-
* Test is a variant of server, so it is not a separate hooks.
|
|
240
|
-
*/
|
|
241
|
-
test: TestConfig;
|
|
242
|
-
/**
|
|
243
|
-
* Level of the log.
|
|
244
|
-
*
|
|
245
|
-
* 日志等级。
|
|
246
|
-
*
|
|
247
|
-
* @default "info"
|
|
248
|
-
*/
|
|
249
|
-
logLevel: LogLevelType;
|
|
250
|
-
}
|
|
251
|
-
interface BuildConfig {
|
|
252
|
-
/**
|
|
253
|
-
* The static assets.
|
|
254
|
-
*
|
|
255
|
-
* - Typically includes icons, ftl files, 3rd party JavaScript files, CSS files, XHTML files, etc.
|
|
256
|
-
* - is an array of `glob` modes and supports negation modes.
|
|
257
|
-
* - Do not add an entire directory unless it has no files to exclude.
|
|
258
|
-
*
|
|
259
|
-
* 静态资源文件。
|
|
260
|
-
*
|
|
261
|
-
* - 通常包括图标、ftl 文件、第三方 JavaScript 文件、CSS 文件、XHTML 文件等。
|
|
262
|
-
* - 是一个 `glob` 模式数组,支持否定模式。
|
|
263
|
-
* - 除非一个目录没有需要排除的文件,否则不要添加整个目录。
|
|
264
|
-
*
|
|
265
|
-
* @see {@link https://github.com/sindresorhus/globby?tab=readme-ov-file#globbing-patterns | Pattern syntax | 语法说明 }
|
|
266
|
-
*
|
|
267
|
-
* @example `["src/**\/*.*", "!src/**\/*.ts"]` (no `\`)
|
|
268
|
-
*
|
|
269
|
-
* @default "addon/**\/*.*" (no `\`)
|
|
270
|
-
*/
|
|
271
|
-
assets: string | string[];
|
|
272
|
-
/**
|
|
273
|
-
* The placeholders to replace in static assets.
|
|
274
|
-
*
|
|
275
|
-
* - At build time, scaffolding uses the key of the placeholder to build the regular pattern `/__${key}__/g` and replaces matches with `value`.
|
|
276
|
-
* - Replacement happens for all files under `assets`.
|
|
277
|
-
*
|
|
278
|
-
* 静态资源文本占位符。
|
|
279
|
-
*
|
|
280
|
-
* - 在构建时,脚手架使用占位符的 key 建立正则模式 `/__${key}__/g`,并将匹配到的内容替换为 `value`。
|
|
281
|
-
* - 替换发生在 `assets` 下的所有文件。
|
|
282
|
-
*
|
|
283
|
-
* @see {@link Context.templateData}
|
|
284
|
-
*/
|
|
285
|
-
define: {
|
|
286
|
-
[key: string]: string;
|
|
287
|
-
};
|
|
288
|
-
fluent: {
|
|
289
|
-
/**
|
|
290
|
-
* Add plugin namespace prefixes to all FTL files to avoid conflicts.
|
|
291
|
-
*
|
|
292
|
-
* The default prefix is `${namespace}-`.
|
|
293
|
-
*
|
|
294
|
-
* 为所有 FTL 文件添加插件前缀以避免冲突。
|
|
295
|
-
*
|
|
296
|
-
* 默认前缀为 `${namespace}-`。
|
|
297
|
-
*
|
|
298
|
-
* @default true
|
|
299
|
-
*/
|
|
300
|
-
prefixLocaleFiles: boolean;
|
|
301
|
-
/**
|
|
302
|
-
* Add plugin namespace prefixes to all FTL messages to avoid conflicts.
|
|
303
|
-
*
|
|
304
|
-
* The default prefix is `${namespace}-`.
|
|
305
|
-
*
|
|
306
|
-
* 为所有 FTL message 添加插件前缀以避免冲突。
|
|
307
|
-
*
|
|
308
|
-
* 默认前缀为 `${namespace}-`。
|
|
309
|
-
*
|
|
310
|
-
* @default true
|
|
311
|
-
*/
|
|
312
|
-
prefixFluentMessages: boolean;
|
|
313
|
-
/**
|
|
314
|
-
* Messages to ignore.
|
|
315
|
-
*
|
|
316
|
-
* 需要忽略的 Fluent Messages。
|
|
317
|
-
*
|
|
318
|
-
* @default []
|
|
319
|
-
*/
|
|
320
|
-
ignore: string[];
|
|
321
|
-
};
|
|
322
|
-
prefs: {
|
|
323
|
-
/**
|
|
324
|
-
* Prefixes the keys of preferences in `prefs.js` and
|
|
325
|
-
* the value of the `preference` attribute in XHTML files.
|
|
326
|
-
*
|
|
327
|
-
* 为 `prefs.js` 中的首选项键和 XHTML 文件中的 `preference` 属性的值
|
|
328
|
-
* 添加前缀。
|
|
329
|
-
*
|
|
330
|
-
* @default true
|
|
331
|
-
*/
|
|
332
|
-
prefixPrefKeys: boolean;
|
|
333
|
-
/**
|
|
334
|
-
* Prefixes for Preference Keys, no dot at the end.
|
|
335
|
-
*
|
|
336
|
-
* 首选项键的前缀,结尾不需要加点号。
|
|
337
|
-
*
|
|
338
|
-
* @default 'extensions.${namespace}'
|
|
339
|
-
*/
|
|
340
|
-
prefix: string;
|
|
341
|
-
/**
|
|
342
|
-
* Generate prefs.d.ts form prefs.js.
|
|
343
|
-
*
|
|
344
|
-
* - false: disable
|
|
345
|
-
* - string: path of dts file
|
|
346
|
-
*
|
|
347
|
-
* 为首选项生成类型声明文件。
|
|
348
|
-
*
|
|
349
|
-
* - false: 禁用
|
|
350
|
-
* - string:dts 文件路径
|
|
351
|
-
*
|
|
352
|
-
* @default 'typings/prefs.d.ts'
|
|
353
|
-
*/
|
|
354
|
-
dts: false | string;
|
|
355
|
-
};
|
|
356
|
-
/**
|
|
357
|
-
* Configurations of esbuild.
|
|
358
|
-
*
|
|
359
|
-
* Paths should be relative to the root directory of the project.
|
|
360
|
-
* And if `outfile` and `outdir` not start with `dist`,
|
|
361
|
-
* `dist/` will be automatically added as a prefix.
|
|
362
|
-
*
|
|
363
|
-
* esbuild 配置。
|
|
364
|
-
*
|
|
365
|
-
* 路径应相对于项目根目录。
|
|
366
|
-
* 其中“outfile”和“outdir”若不以 `dist` 开头,
|
|
367
|
-
* 则会自动添加 `dist/` 前缀。
|
|
368
|
-
*
|
|
369
|
-
* @default []
|
|
370
|
-
*
|
|
371
|
-
*/
|
|
372
|
-
esbuildOptions: BuildOptions[];
|
|
373
|
-
/**
|
|
374
|
-
* Make manifest.json.
|
|
375
|
-
*
|
|
376
|
-
*/
|
|
377
|
-
makeManifest: {
|
|
378
|
-
/**
|
|
379
|
-
* 是否自动管理 manifest.json。
|
|
380
|
-
* 如果此项为 false,则开发者应自行准备 manifest.json。
|
|
381
|
-
*
|
|
382
|
-
* @default true
|
|
383
|
-
*/
|
|
384
|
-
enable: boolean;
|
|
385
|
-
/**
|
|
386
|
-
* template of manifest.
|
|
387
|
-
*
|
|
388
|
-
* @deprecated
|
|
389
|
-
*
|
|
390
|
-
* @default
|
|
391
|
-
*
|
|
392
|
-
* ```json
|
|
393
|
-
* {
|
|
394
|
-
* manifest_version: 2,
|
|
395
|
-
* name: "${name}",
|
|
396
|
-
* version: "${version}",
|
|
397
|
-
* applications: {
|
|
398
|
-
* zotero: {
|
|
399
|
-
* id: "${id}",
|
|
400
|
-
* update_url: "${updateURL}",
|
|
401
|
-
* strict_min_version: "6.999",
|
|
402
|
-
* strict_max_version: "7.0.*",
|
|
403
|
-
* },
|
|
404
|
-
* gecko: {
|
|
405
|
-
* id: "${id}",
|
|
406
|
-
* update_url: "${updateURL}",
|
|
407
|
-
* strict_min_version: "102",
|
|
408
|
-
* };
|
|
409
|
-
* };
|
|
410
|
-
* };
|
|
411
|
-
* ```
|
|
412
|
-
*/
|
|
413
|
-
template: Manifest;
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* Make update manifest.
|
|
417
|
-
*
|
|
418
|
-
* 生成 `update.json`。
|
|
419
|
-
*
|
|
420
|
-
*/
|
|
421
|
-
makeUpdateJson: {
|
|
422
|
-
/**
|
|
423
|
-
* Historical update data.
|
|
424
|
-
*
|
|
425
|
-
* This can be useful if you need to distribute different plugin versions
|
|
426
|
-
* for different versions of Zotero.
|
|
427
|
-
*
|
|
428
|
-
* 已有的更新数据。
|
|
429
|
-
*
|
|
430
|
-
* 如果你需要为不同版本的 Zotero 分发不同的插件版本,这可能会很有用。
|
|
431
|
-
*
|
|
432
|
-
* @see {@link https://www.zotero.org/support/dev/zotero_7_for_developers#updaterdf_updatesjson | Zotero 7 for developers}
|
|
433
|
-
* @see {@link https://extensionworkshop.com/documentation/manage/updating-your-extension/ | Updating your extension}
|
|
434
|
-
* @see {@link https://zotero-chinese.com/plugin-dev-guide/reference/update | 更新清单 (In chinese)}
|
|
435
|
-
*
|
|
436
|
-
* @default []
|
|
437
|
-
*/
|
|
438
|
-
updates: UpdateJSON["addons"][string]["updates"];
|
|
439
|
-
/**
|
|
440
|
-
* Whether or not to write the hash of the xpi file to update.json.
|
|
441
|
-
*
|
|
442
|
-
* 是否向 update.json 中写入 xpi 文件的 hash。
|
|
443
|
-
*
|
|
444
|
-
* @default true
|
|
445
|
-
*/
|
|
446
|
-
hash: boolean;
|
|
447
|
-
};
|
|
448
|
-
/**
|
|
449
|
-
* The lifecycle hooks.
|
|
450
|
-
*/
|
|
451
|
-
hooks: Partial<BuildHooks>;
|
|
452
|
-
}
|
|
453
|
-
interface BuildHooks {
|
|
454
|
-
"build:init": (ctx: Context) => void | Promise<void>;
|
|
455
|
-
"build:mkdir": (ctx: Context) => void | Promise<void>;
|
|
456
|
-
"build:copyAssets": (ctx: Context) => void | Promise<void>;
|
|
457
|
-
"build:makeManifest": (ctx: Context) => void | Promise<void>;
|
|
458
|
-
"build:fluent": (ctx: Context) => void | Promise<void>;
|
|
459
|
-
"build:bundle": (ctx: Context) => void | Promise<void>;
|
|
460
|
-
"build:pack": (ctx: Context) => void | Promise<void>;
|
|
461
|
-
"build:makeUpdateJSON": (ctx: Context) => void | Promise<void>;
|
|
462
|
-
"build:done": (ctx: Context) => void | Promise<void>;
|
|
463
|
-
}
|
|
464
|
-
interface ServerConfig {
|
|
465
|
-
/**
|
|
466
|
-
* Open devtool on Zotero start.
|
|
467
|
-
*
|
|
468
|
-
* 在 Zotero 启动时打开 devtool。
|
|
469
|
-
*
|
|
470
|
-
* @default true
|
|
471
|
-
*/
|
|
472
|
-
devtools: boolean;
|
|
473
|
-
/**
|
|
474
|
-
* Additional command line arguments when starting Zotero.
|
|
475
|
-
*
|
|
476
|
-
* 启动 Zotero 时附加的命令行参数。
|
|
477
|
-
*
|
|
478
|
-
* @default []
|
|
479
|
-
*/
|
|
480
|
-
startArgs: string[];
|
|
481
|
-
/**
|
|
482
|
-
* Install the plugin as a Proxy File mode.
|
|
483
|
-
*
|
|
484
|
-
* 以 Proxy File 方式载入插件
|
|
485
|
-
*
|
|
486
|
-
* @default false
|
|
487
|
-
*/
|
|
488
|
-
asProxy: boolean;
|
|
489
|
-
prebuild: boolean;
|
|
490
|
-
createProfileIfMissing: boolean;
|
|
491
|
-
/**
|
|
492
|
-
* The lifecycle hook.
|
|
493
|
-
*/
|
|
494
|
-
hooks: Partial<ServeHooks>;
|
|
495
|
-
}
|
|
496
|
-
interface ServeHooks {
|
|
497
|
-
"serve:init": (ctx: Context) => void | Promise<void>;
|
|
498
|
-
"serve:prebuild": (ctx: Context) => void | Promise<void>;
|
|
499
|
-
"serve:ready": (ctx: Context) => void | Promise<void>;
|
|
500
|
-
"serve:onChanged": (ctx: Context, path: string) => void | Promise<void>;
|
|
501
|
-
"serve:onReloaded": (ctx: Context) => void | Promise<void>;
|
|
502
|
-
"serve:exit": (ctx: Context) => void;
|
|
503
|
-
}
|
|
504
|
-
interface ReleaseConfig {
|
|
505
|
-
/**
|
|
506
|
-
* Configurations of bumpp
|
|
507
|
-
*
|
|
508
|
-
* bumpp 包的部分配置。
|
|
509
|
-
*/
|
|
510
|
-
bumpp: {
|
|
511
|
-
/**
|
|
512
|
-
* The release version or type. Can be one of the following:
|
|
513
|
-
*
|
|
514
|
-
* - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
|
|
515
|
-
* - "prompt" to prompt the user for the version number
|
|
516
|
-
*
|
|
517
|
-
* In general, it is recommended to set this to “prompt”.
|
|
518
|
-
* If you need a command that always releases a certain type,
|
|
519
|
-
* you can override this option on the command line.
|
|
520
|
-
*
|
|
521
|
-
* 发布的类型,可以是以下其中之一:
|
|
522
|
-
*
|
|
523
|
-
* - 版本类型(如 “major”、“minor”、“patch”、“prerelease”等)
|
|
524
|
-
* - “prompt” 以选择版本号
|
|
525
|
-
*
|
|
526
|
-
* 通常来说,建议将此项设置为“prompt”。
|
|
527
|
-
* 如果需要一个始终发布某类型的命令,可以在命令行中覆盖该选项。
|
|
528
|
-
*
|
|
529
|
-
* @default "prompt"
|
|
530
|
-
*/
|
|
531
|
-
release: string;
|
|
532
|
-
/**
|
|
533
|
-
* The prerelease type (e.g. "alpha", "beta", "next").
|
|
534
|
-
*
|
|
535
|
-
* 预发布的类型,如 alpha,beta,next 等。
|
|
536
|
-
*
|
|
537
|
-
* @default "beta"
|
|
538
|
-
*/
|
|
539
|
-
preid: string;
|
|
540
|
-
/**
|
|
541
|
-
* The commit message.
|
|
542
|
-
*
|
|
543
|
-
* Any `%s` placeholders in the message string will be replaced with the new version number.
|
|
544
|
-
* If the message string does _not_ contain any `%s` placeholders,
|
|
545
|
-
* then the new version number will be appended to the message.
|
|
546
|
-
*
|
|
547
|
-
* 提交说明模板。
|
|
548
|
-
*
|
|
549
|
-
* 模板中的 `%s` 占位符将被替换为新版本号。
|
|
550
|
-
* 如果模板中不包含任何 `%s` 占位符,则新版本号将附加到模板末端。
|
|
551
|
-
*
|
|
552
|
-
* @default "chore(publish): release %s"
|
|
553
|
-
*/
|
|
554
|
-
commit: string;
|
|
555
|
-
/**
|
|
556
|
-
* The tag template.
|
|
557
|
-
*
|
|
558
|
-
* Any `%s` placeholders in the tag string will be replaced with the new version number.
|
|
559
|
-
* If the tag string does _not_ contain any `%s` placeholders,
|
|
560
|
-
* then the new version number will be appended to the tag.
|
|
561
|
-
*
|
|
562
|
-
* 标签模板。
|
|
563
|
-
*
|
|
564
|
-
* 模板中的 `%s` 占位符将被替换为新版本号。
|
|
565
|
-
* 如果模板中不包含任何 `%s` 占位符,则新版本号将附加到模板末端。
|
|
566
|
-
*
|
|
567
|
-
* @default "v%s"
|
|
568
|
-
*/
|
|
569
|
-
tag: string;
|
|
570
|
-
/**
|
|
571
|
-
* Indicates whether the git commit should include ALL files (`git commit --all`)
|
|
572
|
-
* rather than just the files that were modified by `versionBump()`.
|
|
573
|
-
*
|
|
574
|
-
* 表示 git 提交是否应包括所有文件(`git commit --all`),
|
|
575
|
-
* 而不是只包含被 `versionBump()` 修改过的文件。
|
|
576
|
-
*
|
|
577
|
-
* @default false
|
|
578
|
-
*
|
|
579
|
-
*/
|
|
580
|
-
all: boolean;
|
|
581
|
-
/**
|
|
582
|
-
* Prompt for confirmation.
|
|
583
|
-
*
|
|
584
|
-
* 选择版本号后是否要求二次确认。
|
|
585
|
-
*
|
|
586
|
-
* @default true
|
|
587
|
-
*/
|
|
588
|
-
confirm: boolean;
|
|
589
|
-
/**
|
|
590
|
-
* Indicates whether to bypass git commit hooks (`git commit --no-verify`).
|
|
591
|
-
*
|
|
592
|
-
* 表示是否绕过 git commit hooks(`git commit --no-verify` )。
|
|
593
|
-
*
|
|
594
|
-
* @default false
|
|
595
|
-
*/
|
|
596
|
-
noVerify: boolean;
|
|
597
|
-
/**
|
|
598
|
-
* Excute additional command after bumping and before commiting.
|
|
599
|
-
*
|
|
600
|
-
* 在提升版本号之后,提交之前运行的额外命令。
|
|
601
|
-
*
|
|
602
|
-
* @default "npm run build"
|
|
603
|
-
*
|
|
604
|
-
*/
|
|
605
|
-
execute: string;
|
|
606
|
-
};
|
|
607
|
-
/**
|
|
608
|
-
* Changelog.
|
|
609
|
-
*
|
|
610
|
-
* - "conventional-changelog": use conventional-changelog with angular preset,
|
|
611
|
-
* you must install "conventional-changelog" as an peer dependency.
|
|
612
|
-
* - string: a command line with changelog output to stdout.
|
|
613
|
-
*
|
|
614
|
-
* 变更日志。
|
|
615
|
-
*
|
|
616
|
-
* - "conventional-changelog": 使用约定式变更日志,使用 angular 预设,
|
|
617
|
-
* 你需要手动安装 conventional-changelog 作为依赖项。
|
|
618
|
-
* - string: 命令行,变更日志输出到 stdout
|
|
619
|
-
*
|
|
620
|
-
* @default "git log {{previousTag}}..{{currentTag}}"
|
|
621
|
-
*/
|
|
622
|
-
changelog: "conventional-changelog" | string | ((ctx: Context) => string);
|
|
623
|
-
/**
|
|
624
|
-
* Release to GitHub.
|
|
625
|
-
*/
|
|
626
|
-
github: {
|
|
627
|
-
/**
|
|
628
|
-
* Enable release to GitHub.
|
|
629
|
-
*
|
|
630
|
-
* Include uploading XPI asset to GitHub release and all following steps.
|
|
631
|
-
*
|
|
632
|
-
* - "ci" to only enable in ci
|
|
633
|
-
* - "local" to only enable in non-ci
|
|
634
|
-
* - "always" to always enable
|
|
635
|
-
* - "false" to always disable
|
|
636
|
-
*
|
|
637
|
-
* @default "ci"
|
|
638
|
-
*/
|
|
639
|
-
enable: "ci" | "local" | "always" | "false";
|
|
640
|
-
/**
|
|
641
|
-
* The information of remote repository.
|
|
642
|
-
*
|
|
643
|
-
* Will be extracted from the `repository` property in `package.json` by default.
|
|
644
|
-
*
|
|
645
|
-
* @default {{owner}}/{{repo}}
|
|
646
|
-
* @see {@link Context.templateData}
|
|
647
|
-
*/
|
|
648
|
-
repository: string;
|
|
649
|
-
/**
|
|
650
|
-
* Upload update.json to release.
|
|
651
|
-
*
|
|
652
|
-
* This is the tagName of the release when the value is a string.
|
|
653
|
-
*
|
|
654
|
-
* 将 update.json 上传到指定的 GitHub release。
|
|
655
|
-
*
|
|
656
|
-
* 当值为字符串时,其为 release 的tagName。
|
|
657
|
-
*
|
|
658
|
-
* @default "release"
|
|
659
|
-
*/
|
|
660
|
-
updater: string | false;
|
|
661
|
-
/**
|
|
662
|
-
* Comment to issues and prs inlcuded in release.
|
|
663
|
-
*
|
|
664
|
-
* @todo Not implemented yet
|
|
665
|
-
*
|
|
666
|
-
* @default false
|
|
667
|
-
*/
|
|
668
|
-
comment: boolean;
|
|
669
|
-
releaseNote: (ctx: Context) => string;
|
|
670
|
-
};
|
|
671
|
-
hooks: Partial<ReleaseHooks>;
|
|
672
|
-
}
|
|
673
|
-
interface ReleaseHooks {
|
|
674
|
-
"release:init": (ctx: Context) => void | Promise<void>;
|
|
675
|
-
"release:push": (ctx: Context) => void | Promise<void>;
|
|
676
|
-
"release:done": (ctx: Context) => void | Promise<void>;
|
|
677
|
-
}
|
|
678
|
-
interface TestConfig {
|
|
679
|
-
/**
|
|
680
|
-
* The test source code directories, starting from the root directory of the project.
|
|
681
|
-
* All `*.spec.js` files in these directories will be executed.
|
|
682
|
-
* The files will be sorted by alphabetical order.
|
|
683
|
-
*
|
|
684
|
-
* 测试源码目录,从项目的根目录开始。
|
|
685
|
-
* 这些目录中的所有 `*.spec.js` 文件将被执行。
|
|
686
|
-
* 文件将按字母顺序排序。
|
|
687
|
-
*
|
|
688
|
-
* @default "test"
|
|
689
|
-
*/
|
|
690
|
-
entries: string | string[];
|
|
691
|
-
/**
|
|
692
|
-
* The default preferences for the test.
|
|
693
|
-
* These preferences will be set before the test starts.
|
|
694
|
-
*
|
|
695
|
-
* 测试的默认首选项。
|
|
696
|
-
* 这些首选项将在测试开始前设置。
|
|
697
|
-
*/
|
|
698
|
-
prefs: Record<string, string | boolean | number>;
|
|
699
|
-
mocha: {
|
|
700
|
-
/**
|
|
701
|
-
* The timeout of the test.
|
|
702
|
-
*
|
|
703
|
-
* 测试的超时时间。
|
|
704
|
-
*
|
|
705
|
-
* @default 10000
|
|
706
|
-
*/
|
|
707
|
-
timeout: number;
|
|
708
|
-
};
|
|
709
|
-
/**
|
|
710
|
-
* Abort the test when the first test fails.
|
|
711
|
-
*
|
|
712
|
-
* 当第一个测试失败时中止测试。
|
|
713
|
-
*
|
|
714
|
-
* @default false
|
|
715
|
-
*/
|
|
716
|
-
abortOnFail: boolean;
|
|
717
|
-
/**
|
|
718
|
-
* Exit Zotero when the test is finished.
|
|
719
|
-
*
|
|
720
|
-
* 测试完成后退出 Zotero。
|
|
721
|
-
*
|
|
722
|
-
* @default false
|
|
723
|
-
*/
|
|
724
|
-
exitOnFinish: boolean;
|
|
725
|
-
/**
|
|
726
|
-
* Run Zotero in deadless mode.
|
|
727
|
-
*
|
|
728
|
-
* - Supported for Linux only.
|
|
729
|
-
* - Default to true when in CI environments.
|
|
730
|
-
*
|
|
731
|
-
* 使用无头模式运行 Zotero。
|
|
732
|
-
*
|
|
733
|
-
* - 仅支持 Linux
|
|
734
|
-
* - 在 CI 模式下,默认为 true
|
|
735
|
-
*
|
|
736
|
-
* @default false
|
|
737
|
-
*/
|
|
738
|
-
headless: boolean;
|
|
739
|
-
/**
|
|
740
|
-
* The delay time before running the test. Make sure the plugin is fully loaded before running the test.
|
|
741
|
-
*
|
|
742
|
-
* 运行测试前的延迟时间。确保插件在运行测试前完全加载。
|
|
743
|
-
*
|
|
744
|
-
* @default 1000
|
|
745
|
-
*/
|
|
746
|
-
startupDelay: number;
|
|
747
|
-
/**
|
|
748
|
-
* Function string that returns the initialization status of the plugin.
|
|
749
|
-
*
|
|
750
|
-
* If set, the test will wait until the function returns true before running the test.
|
|
751
|
-
*
|
|
752
|
-
* 返回插件初始化状态的函数字符串。
|
|
753
|
-
*
|
|
754
|
-
* 如果设置,测试将等待函数返回 true 后再运行测试。
|
|
755
|
-
*
|
|
756
|
-
* @default "() => true"
|
|
757
|
-
*
|
|
758
|
-
* @example
|
|
759
|
-
* ```js
|
|
760
|
-
* () => !!Zotero.BetterNotes.data.initialized
|
|
761
|
-
* ```
|
|
762
|
-
*/
|
|
763
|
-
waitForPlugin: string;
|
|
764
|
-
/**
|
|
765
|
-
* @todo not
|
|
766
|
-
*/
|
|
767
|
-
watch: boolean;
|
|
768
|
-
hooks: Partial<TestHooks>;
|
|
769
|
-
}
|
|
770
|
-
interface TestHooks {
|
|
771
|
-
"test:init": (ctx: Context) => void | Promise<void>;
|
|
772
|
-
"test:prebuild": (ctx: Context) => void | Promise<void>;
|
|
773
|
-
"test:listen": (ctx: Context) => void | Promise<void>;
|
|
774
|
-
"test:copyAssets": (ctx: Context) => void | Promise<void>;
|
|
775
|
-
"test:bundleTests": (ctx: Context) => void | Promise<void>;
|
|
776
|
-
"test:run": (ctx: Context) => void | Promise<void>;
|
|
777
|
-
"test:exit": (ctx: Context) => void;
|
|
778
|
-
}
|
|
779
|
-
interface Hooks extends BuildHooks, ServeHooks, ReleaseHooks, TestHooks {
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
type RecursivePartial<T> = {
|
|
783
|
-
[P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
784
|
-
};
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* User config
|
|
788
|
-
*/
|
|
789
|
-
interface UserConfig extends RecursivePartial<Config$1> {
|
|
790
|
-
}
|
|
791
|
-
interface OverrideConfig extends RecursivePartial<Config$1> {
|
|
792
|
-
}
|
|
793
|
-
interface Context extends Config$1 {
|
|
794
|
-
pkgUser: any;
|
|
795
|
-
version: string;
|
|
796
|
-
hooks: Hookable<Hooks>;
|
|
797
|
-
logger: Logger;
|
|
798
|
-
templateData: TemplateData;
|
|
799
|
-
}
|
|
800
|
-
interface TemplateData {
|
|
801
|
-
/**
|
|
802
|
-
* `owner` and `repo` will be extracted from the `repository` property in `package.json`.
|
|
803
|
-
*/
|
|
804
|
-
owner: string;
|
|
805
|
-
repo: string;
|
|
806
|
-
version: string;
|
|
807
|
-
isPreRelease: string;
|
|
808
|
-
updateJson: "update-beta.json" | "update.json" | string;
|
|
809
|
-
xpiName: string;
|
|
810
|
-
buildTime: string;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* Helper for user define configuration.
|
|
815
|
-
*/
|
|
816
|
-
declare function defineConfig(userConfig: UserConfig): UserConfig;
|
|
817
|
-
/**
|
|
818
|
-
* Loads config
|
|
819
|
-
* @param [overrides] Highest Priority Configuration.
|
|
820
|
-
* @returns Config with userDefined and defaultConfig merged.
|
|
821
|
-
*/
|
|
822
|
-
declare function loadConfig(overrides?: OverrideConfig): Promise<Context>;
|
|
823
|
-
|
|
824
|
-
declare abstract class Base {
|
|
825
|
-
ctx: Context;
|
|
826
|
-
constructor(ctx: Context);
|
|
827
|
-
abstract run(): any;
|
|
828
|
-
get logger(): Logger;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
declare class Build extends Base {
|
|
832
|
-
private buildTime;
|
|
833
|
-
private isPreRelease;
|
|
834
|
-
constructor(ctx: Context);
|
|
835
|
-
/**
|
|
836
|
-
* Default build runner
|
|
837
|
-
*/
|
|
838
|
-
run(): Promise<void>;
|
|
839
|
-
/**
|
|
840
|
-
* Copys files in `Config.build.assets` to `Config.dist`
|
|
841
|
-
*/
|
|
842
|
-
makeAssets(): Promise<void>;
|
|
843
|
-
/**
|
|
844
|
-
* Override user's manifest
|
|
845
|
-
*
|
|
846
|
-
*/
|
|
847
|
-
makeManifest(): Promise<void>;
|
|
848
|
-
prepareLocaleFiles(): Promise<void>;
|
|
849
|
-
preparePrefs(): Promise<void>;
|
|
850
|
-
esbuild(): Promise<esbuild.BuildResult<esbuild.BuildOptions>[]> | undefined;
|
|
851
|
-
makeUpdateJson(): Promise<void>;
|
|
852
|
-
pack(): Promise<void>;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
declare class Release extends Base {
|
|
856
|
-
constructor(ctx: Context);
|
|
857
|
-
/**
|
|
858
|
-
* Runs release
|
|
859
|
-
*
|
|
860
|
-
* if is not CI,bump version, git add (package.json), git commit, git tag, git push;
|
|
861
|
-
* if is CI, do not bump version, do not run git, create release (tag is `v${version}`) and upload xpi,
|
|
862
|
-
* then, create or update release (tag is "release"), update `update.json`.
|
|
863
|
-
*/
|
|
864
|
-
run(): Promise<void>;
|
|
865
|
-
getConventionalChangelog(): Promise<string>;
|
|
866
|
-
getGitLog(): string;
|
|
867
|
-
getFilteredChangelog(rawLog: string): string;
|
|
868
|
-
getChangelog(): Promise<string>;
|
|
869
|
-
private isEnabled;
|
|
870
|
-
get resolvedCommitMessage(): string;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
declare class Serve extends Base {
|
|
874
|
-
private builder;
|
|
875
|
-
private runner?;
|
|
876
|
-
private _zoteroBinPath?;
|
|
877
|
-
constructor(ctx: Context);
|
|
878
|
-
run(): Promise<void>;
|
|
879
|
-
/**
|
|
880
|
-
* watch source dir and build when file changed
|
|
881
|
-
*/
|
|
882
|
-
watch(): Promise<void>;
|
|
883
|
-
onChange(path: string): Promise<void>;
|
|
884
|
-
reload(): Promise<void>;
|
|
885
|
-
exit: () => never;
|
|
886
|
-
private onZoteroExit;
|
|
887
|
-
get zoteroBinPath(): string;
|
|
888
|
-
get profilePath(): string | undefined;
|
|
889
|
-
get dataDir(): string | undefined;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
declare class Test extends Base {
|
|
893
|
-
private builder;
|
|
894
|
-
private runner?;
|
|
895
|
-
private communicator;
|
|
896
|
-
constructor(ctx: Context);
|
|
897
|
-
run(): Promise<void>;
|
|
898
|
-
createTestPlugin(): Promise<void>;
|
|
899
|
-
copyTestLibraries(): Promise<void>;
|
|
900
|
-
bundleTests(): Promise<void>;
|
|
901
|
-
startHttpServer(): Promise<void>;
|
|
902
|
-
onHttpDataUpdated(body: {
|
|
903
|
-
type: "start" | "suite" | "suite end" | "pending" | "pass" | "fail" | "end" | "debug";
|
|
904
|
-
data?: {
|
|
905
|
-
title: string;
|
|
906
|
-
str: string;
|
|
907
|
-
duration?: number;
|
|
908
|
-
stack?: string;
|
|
909
|
-
};
|
|
910
|
-
}): Promise<void>;
|
|
911
|
-
watch(): Promise<void>;
|
|
912
|
-
onCodeChanged(_path: string): Promise<void>;
|
|
913
|
-
startZoteroHeadless(): Promise<void>;
|
|
914
|
-
startZotero(): Promise<void>;
|
|
915
|
-
private exit;
|
|
916
|
-
private get zoteroBinPath();
|
|
917
|
-
private get profilePath();
|
|
918
|
-
private get dataDir();
|
|
919
|
-
private get testPluginDir();
|
|
920
|
-
private get cacheDir();
|
|
921
|
-
private get testPluginRef();
|
|
922
|
-
private get testPluginID();
|
|
923
|
-
private get prefs();
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
declare const Config: {
|
|
927
|
-
defineConfig: typeof defineConfig;
|
|
928
|
-
loadConfig: typeof loadConfig;
|
|
929
|
-
};
|
|
930
|
-
|
|
931
|
-
export { Build, Config, Release, Serve, Test, defineConfig };
|
package/dist/vendor/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as esToolkit from 'es-toolkit';
|
|
2
|
-
export { esToolkit };
|
|
3
|
-
import * as esm from 'fs-extra/esm';
|
|
4
|
-
export { esm as fse };
|
|
5
|
-
|
|
6
|
-
declare function replace(contents: string, from: RegExp | RegExp[], to: string | string[]): string;
|
|
7
|
-
declare function replaceInFile({ files, from, to, isGlob }: {
|
|
8
|
-
files: string | string[];
|
|
9
|
-
from: RegExp | RegExp[];
|
|
10
|
-
to: string | string[];
|
|
11
|
-
isGlob?: boolean;
|
|
12
|
-
}): Promise<void>;
|
|
13
|
-
|
|
14
|
-
export { replace, replaceInFile };
|