zotero-plugin-scaffold 0.8.8 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,908 @@
1
+ import { Hookable } from "hookable";
2
+ import { BuildOptions } from "esbuild";
3
+ import { VersionBumpRelease } from "bumpp";
4
+ //#region src/utils/logger.d.ts
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: string): void;
48
+ log(content: unknown, options?: LoggerOptions): void;
49
+ clear(): void;
50
+ newLine(): void;
51
+ }
52
+ //#endregion
53
+ //#region node_modules/.pnpm/changelogen@0.6.2/node_modules/changelogen/dist/index.d.mts
54
+ interface GitCommitAuthor {
55
+ name: string;
56
+ email: string;
57
+ }
58
+ interface RawGitCommit {
59
+ message: string;
60
+ body: string;
61
+ shortHash: string;
62
+ author: GitCommitAuthor;
63
+ }
64
+ interface Reference {
65
+ type: "hash" | "issue" | "pull-request";
66
+ value: string;
67
+ }
68
+ interface GitCommit extends RawGitCommit {
69
+ description: string;
70
+ type: string;
71
+ scope: string;
72
+ references: Reference[];
73
+ authors: GitCommitAuthor[];
74
+ isBreaking: boolean;
75
+ }
76
+ //#endregion
77
+ //#region src/types/manifest.d.ts
78
+ interface Manifest {
79
+ [key: string]: any;
80
+ manifest_version: number;
81
+ name: string;
82
+ version: string;
83
+ description?: string;
84
+ homepage_url?: string;
85
+ author?: string;
86
+ icons?: Record<string, string>;
87
+ applications: {
88
+ zotero: {
89
+ id: string;
90
+ update_url: string;
91
+ strict_min_version?: string;
92
+ strict_max_version?: string;
93
+ };
94
+ };
95
+ }
96
+ //#endregion
97
+ //#region src/types/update-json.d.ts
98
+ /**
99
+ * Update json
100
+ * @see https://extensionworkshop.com/documentation/manage/updating-your-extension/
101
+ */
102
+ interface UpdateJSON {
103
+ addons: {
104
+ [addonID: string]: {
105
+ updates: Array<{
106
+ version: string;
107
+ update_link?: string;
108
+ /**
109
+ * A cryptographic hash of the file pointed to by `update_link`.
110
+ * This must be provided if `update_link` is not a secure URL.
111
+ * If present, this must be a string beginning with either `sha256:` or `sha512:`,
112
+ * followed by the hexadecimal-encoded hash of the matching type.
113
+ */
114
+ update_hash?: string;
115
+ applications: {
116
+ zotero: {
117
+ strict_min_version?: string;
118
+ strict_max_version?: string;
119
+ };
120
+ [application: string]: {
121
+ strict_min_version?: string;
122
+ strict_max_version?: string;
123
+ };
124
+ };
125
+ }>;
126
+ };
127
+ };
128
+ }
129
+ //#endregion
130
+ //#region src/types/config.d.ts
131
+ interface Config {
132
+ /**
133
+ * Source root directory or directories for the plugin.
134
+ *
135
+ * These paths are:
136
+ * - Watched during development to trigger rebuilds on changes.
137
+ * - Used to remove the top-level asset directory (e.g. `assets/`) during build,
138
+ * so that only its contents are copied directly to the output root.
139
+ *
140
+ * 插件的源码根目录(可为字符串或字符串数组)。
141
+ *
142
+ * 用于以下两个目的:
143
+ * - 在开发模式下监听这些目录,以便在文件变更时触发重建;
144
+ * - 在构建阶段中,用于识别 assets 所在的顶层目录,以移除该目录本身,仅将其内容复制到输出目录的根部。
145
+ *
146
+ * @example ["src", "addon"]
147
+ * @default "src"
148
+ */
149
+ source: string | string[];
150
+ /**
151
+ * The files to ignore when watching.
152
+ *
153
+ * 忽略的监听文件。
154
+ *
155
+ * @default []
156
+ */
157
+ watchIgnore: string | string[] | RegExp | RegExp[];
158
+ /**
159
+ * The build directories.
160
+ *
161
+ * Scaffold will store the code before packaging after the build at `${dist}/addon`.
162
+ * Store the packaging results at `${dist}/${package_json.name}.xpi`.
163
+ *
164
+ * 构建目录。
165
+ *
166
+ * 脚手架将在 `${dist}/addon` 存放构建后打包前的代码。
167
+ * 在 `${dist}/${xpiName}.xpi` 存放打包结果。
168
+ *
169
+ * @default ".scaffold/build"
170
+ */
171
+ dist: string;
172
+ /**
173
+ * The name of plugin.
174
+ *
175
+ * 插件名。
176
+ *
177
+ * @default package-json.name
178
+ *
179
+ */
180
+ name: string;
181
+ /**
182
+ * The ID of plugin.
183
+ *
184
+ * Usually in the form of an email address or UUID.
185
+ *
186
+ * 插件 ID。
187
+ *
188
+ * 通常是邮箱地址或UUID的形式。
189
+ *
190
+ * @default package-json.name
191
+ */
192
+ id: string;
193
+ /**
194
+ * namespace of plugin.
195
+ *
196
+ * This attribute is also used to prevent plugin conflicts,
197
+ * it may be used for plugin HTML element ids, preference prefixes,
198
+ * fluent filename prefixes, fluent message prefixes, etc.
199
+ *
200
+ * Unlike the plugin id, this value should be HTML ID and Fluent Message compliant,
201
+ * i.e.: contain at least one character and only letters and dashes.
202
+ *
203
+ * 插件命名空间。
204
+ *
205
+ * 这个属性也用于防止插件冲突,它可能被用于插件的 HTML 元素 id,
206
+ * 首选项前缀,Fluent 文件名前缀、Fluent message 前缀等。
207
+ *
208
+ * 与插件 ID 不同的是,这个值应是符合 HTML ID 和 Fluent Message 规范的,
209
+ * 即:至少包含一个字符,仅包含字母和短横线。
210
+ *
211
+ * @default kebabCase(name)
212
+ */
213
+ namespace: string;
214
+ /**
215
+ * XPI filename.
216
+ *
217
+ * XPI 文件名。
218
+ *
219
+ * @default kebabCase(name)
220
+ */
221
+ xpiName: string;
222
+ /**
223
+ * The download link of XPI.
224
+ *
225
+ * Some placeholders are available, see Context.templateData.
226
+ *
227
+ * XPI 文件的地址。
228
+ *
229
+ * 一些可用的占位符请参阅 Context.templateData。
230
+ *
231
+ * @default `https://github.com/{{owner}}/{{repo}}/release/download/v{{version}}/{{xpiName}}.xpi`
232
+ *
233
+ * @see {@link Context.templateData}
234
+ */
235
+ xpiDownloadLink: string;
236
+ /**
237
+ * The uri of update.json.
238
+ *
239
+ * Some placeholders are available, see Context.templateData.
240
+ *
241
+ * update.json 文件的地址。
242
+ *
243
+ * 一些可用的占位符请参阅 Context.templateData。
244
+ *
245
+ * @default `https://github.com/{{owner}}/{{repo}}/releaser/download/release/{{updateJson}}`
246
+ *
247
+ * @see {@link Context.templateData}
248
+ */
249
+ updateURL: string;
250
+ /**
251
+ * Configurations required to run the build.
252
+ *
253
+ * 构建所需的配置。
254
+ */
255
+ build: BuildConfig;
256
+ /**
257
+ * Configurations required to run the server.
258
+ *
259
+ * serve 所需的配置。
260
+ */
261
+ server: ServerConfig;
262
+ /**
263
+ * @todo Use addonLint package to lint XPI.
264
+ */
265
+ addonLint: object;
266
+ /**
267
+ * Configurations required to run the release.
268
+ *
269
+ * 发布相关配置。
270
+ */
271
+ release: ReleaseConfig;
272
+ /**
273
+ * Configurations required to run the test.
274
+ *
275
+ * 测试相关配置。
276
+ *
277
+ * Test is a variant of server, so it is not a separate hooks.
278
+ */
279
+ test: TestConfig;
280
+ /**
281
+ * Level of the log.
282
+ *
283
+ * 日志等级。
284
+ *
285
+ * @default "info"
286
+ */
287
+ logLevel: LogLevelType;
288
+ }
289
+ interface BuildConfig {
290
+ /**
291
+ * The static assets.
292
+ *
293
+ * - Typically includes icons, ftl files, 3rd party JavaScript files, CSS files, XHTML files, etc.
294
+ * - is an array of `glob` modes and supports negation modes.
295
+ * - Do not add an entire directory unless it has no files to exclude.
296
+ *
297
+ * 静态资源文件。
298
+ *
299
+ * - 通常包括图标、ftl 文件、第三方 JavaScript 文件、CSS 文件、XHTML 文件等。
300
+ * - 是一个 `glob` 模式数组,支持否定模式。
301
+ * - 除非一个目录没有需要排除的文件,否则不要添加整个目录。
302
+ *
303
+ * @see {@link https://github.com/sindresorhus/globby?tab=readme-ov-file#globbing-patterns | Pattern syntax | 语法说明 }
304
+ *
305
+ * @example `["src/**\/*.*", "!src/**\/*.ts"]` (no `\`)
306
+ *
307
+ * @default "addon/**\/*.*" (no `\`)
308
+ */
309
+ assets: string | string[];
310
+ /**
311
+ * The placeholders to replace in static assets.
312
+ *
313
+ * - At build time, scaffolding uses the key of the placeholder to build the regular pattern `/__${key}__/g` and replaces matches with `value`.
314
+ * - Replacement happens for all files under `assets`.
315
+ *
316
+ * 静态资源文本占位符。
317
+ *
318
+ * - 在构建时,脚手架使用占位符的 key 建立正则模式 `/__${key}__/g`,并将匹配到的内容替换为 `value`。
319
+ * - 替换发生在 `assets` 下的所有文件。
320
+ *
321
+ * @see {@link Context.templateData}
322
+ */
323
+ define: {
324
+ [key: string]: string;
325
+ };
326
+ fluent: {
327
+ /**
328
+ * Add plugin namespace prefixes to all FTL files to avoid conflicts.
329
+ *
330
+ * The default prefix is `${namespace}-`.
331
+ *
332
+ * 为所有 FTL 文件添加插件前缀以避免冲突。
333
+ *
334
+ * 默认前缀为 `${namespace}-`。
335
+ *
336
+ * @default true
337
+ */
338
+ prefixLocaleFiles: boolean;
339
+ /**
340
+ * Add plugin namespace prefixes to all FTL messages to avoid conflicts.
341
+ *
342
+ * The default prefix is `${namespace}-`.
343
+ *
344
+ * 为所有 FTL message 添加插件前缀以避免冲突。
345
+ *
346
+ * 默认前缀为 `${namespace}-`。
347
+ *
348
+ * @default true
349
+ */
350
+ prefixFluentMessages: boolean;
351
+ /**
352
+ * Messages to ignore.
353
+ *
354
+ * 需要忽略的 Fluent Messages。
355
+ *
356
+ * @default []
357
+ */
358
+ ignore: string[];
359
+ /**
360
+ * Generate i10n.d.ts form fluent messages.
361
+ *
362
+ * - false: disable
363
+ * - string: path of dts file
364
+ *
365
+ * 为 Fluent messages 生成类型声明文件。
366
+ *
367
+ * - false: 禁用
368
+ * - string:dts 文件路径
369
+ *
370
+ * @default 'typings/i10n.d.ts'
371
+ */
372
+ dts: string | false;
373
+ };
374
+ prefs: {
375
+ /**
376
+ * Prefixes the keys of preferences in `prefs.js` and
377
+ * the value of the `preference` attribute in XHTML files.
378
+ *
379
+ * 为 `prefs.js` 中的首选项键和 XHTML 文件中的 `preference` 属性的值
380
+ * 添加前缀。
381
+ *
382
+ * @default true
383
+ */
384
+ prefixPrefKeys: boolean;
385
+ /**
386
+ * Prefixes for Preference Keys, no dot at the end.
387
+ *
388
+ * 首选项键的前缀,结尾不需要加点号。
389
+ *
390
+ * @default 'extensions.${namespace}'
391
+ */
392
+ prefix: string;
393
+ /**
394
+ * Generate prefs.d.ts form prefs.js.
395
+ *
396
+ * - false: disable
397
+ * - string: path of dts file
398
+ *
399
+ * 为首选项生成类型声明文件。
400
+ *
401
+ * - false: 禁用
402
+ * - string:dts 文件路径
403
+ *
404
+ * @default 'typings/prefs.d.ts'
405
+ */
406
+ dts: false | string;
407
+ };
408
+ /**
409
+ * Configurations of esbuild.
410
+ *
411
+ * Paths should be relative to the root directory of the project.
412
+ * And if `outfile` and `outdir` not start with `dist`,
413
+ * `dist/` will be automatically added as a prefix.
414
+ *
415
+ * esbuild 配置。
416
+ *
417
+ * 路径应相对于项目根目录。
418
+ * 其中“outfile”和“outdir”若不以 `dist` 开头,
419
+ * 则会自动添加 `dist/` 前缀。
420
+ *
421
+ * @default []
422
+ *
423
+ */
424
+ esbuildOptions: BuildOptions[];
425
+ /**
426
+ * Make manifest.json.
427
+ *
428
+ */
429
+ makeManifest: {
430
+ /**
431
+ * 是否自动管理 manifest.json。
432
+ * 如果此项为 false,则开发者应自行准备 manifest.json。
433
+ *
434
+ * @default true
435
+ */
436
+ enable: boolean;
437
+ /**
438
+ * template of manifest.
439
+ *
440
+ * @deprecated
441
+ *
442
+ * @default
443
+ *
444
+ * ```json
445
+ * {
446
+ * manifest_version: 2,
447
+ * name: "${name}",
448
+ * version: "${version}",
449
+ * applications: {
450
+ * zotero: {
451
+ * id: "${id}",
452
+ * update_url: "${updateURL}",
453
+ * strict_min_version: "6.999",
454
+ * strict_max_version: "7.0.*",
455
+ * },
456
+ * gecko: {
457
+ * id: "${id}",
458
+ * update_url: "${updateURL}",
459
+ * strict_min_version: "102",
460
+ * };
461
+ * };
462
+ * };
463
+ * ```
464
+ */
465
+ template: Manifest;
466
+ };
467
+ /**
468
+ * Make update manifest.
469
+ *
470
+ * 生成 `update.json`。
471
+ *
472
+ */
473
+ makeUpdateJson: {
474
+ /**
475
+ * Historical update data.
476
+ *
477
+ * This can be useful if you need to distribute different plugin versions
478
+ * for different versions of Zotero.
479
+ *
480
+ * 已有的更新数据。
481
+ *
482
+ * 如果你需要为不同版本的 Zotero 分发不同的插件版本,这可能会很有用。
483
+ *
484
+ * @see {@link https://www.zotero.org/support/dev/zotero_7_for_developers#updaterdf_updatesjson | Zotero 7 for developers}
485
+ * @see {@link https://extensionworkshop.com/documentation/manage/updating-your-extension/ | Updating your extension}
486
+ * @see {@link https://zotero-chinese.com/plugin-dev-guide/reference/update | 更新清单 (In chinese)}
487
+ *
488
+ * @default []
489
+ */
490
+ updates: UpdateJSON["addons"][string]["updates"];
491
+ /**
492
+ * Whether or not to write the hash of the xpi file to update.json.
493
+ *
494
+ * 是否向 update.json 中写入 xpi 文件的 hash。
495
+ *
496
+ * @default true
497
+ */
498
+ hash: boolean;
499
+ };
500
+ /**
501
+ * The lifecycle hooks.
502
+ */
503
+ hooks: Partial<BuildHooks>;
504
+ }
505
+ interface BuildHooks {
506
+ "build:init": (ctx: Context) => void | Promise<void>;
507
+ "build:mkdir": (ctx: Context) => void | Promise<void>;
508
+ "build:copyAssets": (ctx: Context) => void | Promise<void>;
509
+ "build:makeManifest": (ctx: Context) => void | Promise<void>;
510
+ "build:fluent": (ctx: Context) => void | Promise<void>;
511
+ "build:bundle": (ctx: Context) => void | Promise<void>;
512
+ "build:pack": (ctx: Context) => void | Promise<void>;
513
+ "build:makeUpdateJSON": (ctx: Context) => void | Promise<void>;
514
+ "build:done": (ctx: Context) => void | Promise<void>;
515
+ }
516
+ interface ServerConfig {
517
+ /**
518
+ * Open devtool on Zotero start.
519
+ *
520
+ * 在 Zotero 启动时打开 devtool。
521
+ *
522
+ * @default true
523
+ */
524
+ devtools: boolean;
525
+ /**
526
+ * Additional command line arguments when starting Zotero.
527
+ *
528
+ * 启动 Zotero 时附加的命令行参数。
529
+ *
530
+ * @default []
531
+ */
532
+ startArgs: string[];
533
+ /**
534
+ * Whether to open the Zotero Debug Output window on startup
535
+ * (appends `-ZoteroDebug`).
536
+ *
537
+ * This only controls the window. Debug output is always recorded when
538
+ * {@link ServerConfig.debugOutputFile} is enabled: scaffold then appends
539
+ * `-ZoteroDebugText`, so `Zotero.debug()` / `dump()` output goes to stdout
540
+ * and is captured into the log file regardless of this option.
541
+ *
542
+ * 是否在启动时打开 Zotero 的 Debug Output 窗口(追加 `-ZoteroDebug`)。
543
+ *
544
+ * 此项仅控制窗口。调试输出在 `debugOutputFile` 启用时被记录到日志文件
545
+ * (见 {@link ServerConfig.debugOutputFile}):此时脚手架追加 `-ZoteroDebugText`,
546
+ * `Zotero.debug()` / `dump()` 输出进 stdout 并被捕获到日志文件,与本选项无关。
547
+ *
548
+ * @default false
549
+ */
550
+ debugOutputWindow: boolean;
551
+ /**
552
+ * Whether to record the Zotero process debug output (stdout/stderr) to
553
+ * log files under `.scaffold/logs/`.
554
+ *
555
+ * - stdout → `.scaffold/logs/zotero-<starttime>.log`
556
+ * - stderr → `.scaffold/logs/zotero-<starttime>-stderr.log`
557
+ *
558
+ *
559
+ * 是否把 Zotero 进程的调试输出(stdout/stderr)写入 `.scaffold/logs/` 下的日志文件。
560
+ *
561
+ * - stdout → `.scaffold/logs/zotero-<启动时间>.log`
562
+ * - stderr → `.scaffold/logs/zotero-<启动时间>-stderr.log`
563
+ *
564
+ *
565
+ * @default true
566
+ */
567
+ debugOutputFile: boolean;
568
+ /**
569
+ * The default preferences for the dev server.
570
+ * These preferences will be set before Zotero starts.
571
+ *
572
+ * 开发服务器的默认首选项。
573
+ * 这些首选项将在 Zotero 启动前设置。
574
+ */
575
+ prefs: Record<string, string | number | boolean>;
576
+ /**
577
+ * Install the plugin as a Proxy File mode.
578
+ *
579
+ * 以 Proxy File 方式载入插件
580
+ *
581
+ * @default false
582
+ */
583
+ asProxy: boolean;
584
+ prebuild: boolean;
585
+ createProfileIfMissing: boolean;
586
+ /**
587
+ * The lifecycle hook.
588
+ */
589
+ hooks: Partial<ServeHooks>;
590
+ }
591
+ interface ServeHooks {
592
+ "serve:init": (ctx: Context) => void | Promise<void>;
593
+ "serve:prebuild": (ctx: Context) => void | Promise<void>;
594
+ "serve:ready": (ctx: Context) => void | Promise<void>;
595
+ "serve:onChanged": (ctx: Context, path: string) => void | Promise<void>;
596
+ "serve:onReloaded": (ctx: Context) => void | Promise<void>;
597
+ "serve:exit": (ctx: Context) => void;
598
+ }
599
+ interface ReleaseConfig {
600
+ /**
601
+ * Configurations of bumpp
602
+ *
603
+ * bumpp 包的部分配置。
604
+ */
605
+ bumpp: {
606
+ /**
607
+ * The release version or type. Can be one of the following:
608
+ *
609
+ * - A release type (e.g. "major", "minor", "patch", "prerelease", etc.)
610
+ * - "prompt" to prompt the user for the version number
611
+ *
612
+ * In general, it is recommended to set this to “prompt”.
613
+ * If you need a command that always releases a certain type,
614
+ * you can override this option on the command line.
615
+ *
616
+ * 发布的类型,可以是以下其中之一:
617
+ *
618
+ * - 版本类型(如 “major”、“minor”、“patch”、“prerelease”等)
619
+ * - “prompt” 以选择版本号
620
+ *
621
+ * 通常来说,建议将此项设置为“prompt”。
622
+ * 如果需要一个始终发布某类型的命令,可以在命令行中覆盖该选项。
623
+ *
624
+ * @default "prompt"
625
+ */
626
+ release: VersionBumpRelease;
627
+ /**
628
+ * The prerelease type (e.g. "alpha", "beta", "next").
629
+ *
630
+ * 预发布的类型,如 alpha,beta,next 等。
631
+ *
632
+ * @default "beta"
633
+ */
634
+ preid: string;
635
+ /**
636
+ * The commit message.
637
+ *
638
+ * Any `%s` placeholders in the message string will be replaced with the new version number.
639
+ * If the message string does _not_ contain any `%s` placeholders,
640
+ * then the new version number will be appended to the message.
641
+ *
642
+ * 提交说明模板。
643
+ *
644
+ * 模板中的 `%s` 占位符将被替换为新版本号。
645
+ * 如果模板中不包含任何 `%s` 占位符,则新版本号将附加到模板末端。
646
+ *
647
+ * @default "chore(publish): release %s"
648
+ */
649
+ commit: string;
650
+ /**
651
+ * The tag template.
652
+ *
653
+ * Any `%s` placeholders in the tag string will be replaced with the new version number.
654
+ * If the tag string does _not_ contain any `%s` placeholders,
655
+ * then the new version number will be appended to the tag.
656
+ *
657
+ * 标签模板。
658
+ *
659
+ * 模板中的 `%s` 占位符将被替换为新版本号。
660
+ * 如果模板中不包含任何 `%s` 占位符,则新版本号将附加到模板末端。
661
+ *
662
+ * @default "v%s"
663
+ */
664
+ tag: string;
665
+ /**
666
+ * Indicates whether the git commit should include ALL files (`git commit --all`)
667
+ * rather than just the files that were modified by `versionBump()`.
668
+ *
669
+ * 表示 git 提交是否应包括所有文件(`git commit --all`),
670
+ * 而不是只包含被 `versionBump()` 修改过的文件。
671
+ *
672
+ * @default false
673
+ *
674
+ */
675
+ all: boolean;
676
+ /**
677
+ * Prompt for confirmation.
678
+ *
679
+ * 选择版本号后是否要求二次确认。
680
+ *
681
+ * @default true
682
+ */
683
+ confirm: boolean;
684
+ /**
685
+ * Indicates whether to bypass git commit hooks (`git commit --no-verify`).
686
+ *
687
+ * 表示是否绕过 git commit hooks(`git commit --no-verify` )。
688
+ *
689
+ * @default false
690
+ */
691
+ noVerify: boolean;
692
+ /**
693
+ * Excute additional command after bumping and before commiting.
694
+ *
695
+ * 在提升版本号之后,提交之前运行的额外命令。
696
+ *
697
+ * @default "npm run build"
698
+ *
699
+ */
700
+ execute: string;
701
+ };
702
+ /**
703
+ * Changelog.
704
+ *
705
+ * - '': Use convention-based changelogs to generate changelogs grouped
706
+ * by type when the first commit is a convention-based commit.
707
+ * Otherwise, a list of commit messages.
708
+ * - string: a command line with changelog output to stdout.
709
+ * - function: a function that returns the changelog.
710
+ *
711
+ * 变更日志。
712
+ *
713
+ * - "": 使用约定式变更日志,当第一次提交是约定式提交时,将按类型分组生成变更日志。
714
+ * 否则,则为提交消息的列表。
715
+ * - string: 命令行,变更日志输出到 stdout
716
+ * - function: 一个函数,返回变更日志。
717
+ *
718
+ * @default ""
719
+ */
720
+ changelog: string | ((ctx: Context, commits: GitCommit[]) => string);
721
+ /**
722
+ * Release to GitHub.
723
+ */
724
+ github: {
725
+ /**
726
+ * Enable release to GitHub.
727
+ *
728
+ * Include uploading XPI asset to GitHub release and all following steps.
729
+ *
730
+ * - "ci" to only enable in ci
731
+ * - "local" to only enable in non-ci
732
+ * - "always" to always enable
733
+ * - "false" to always disable
734
+ *
735
+ * @default "ci"
736
+ */
737
+ enable: "ci" | "local" | "always" | "false";
738
+ /**
739
+ * The information of remote repository.
740
+ *
741
+ * Will be extracted from the `repository` property in `package.json` by default.
742
+ *
743
+ * @default {{owner}}/{{repo}}
744
+ * @see {@link Context.templateData}
745
+ */
746
+ repository: string;
747
+ /**
748
+ * Upload update.json to release.
749
+ *
750
+ * This is the tagName of the release when the value is a string.
751
+ *
752
+ * 将 update.json 上传到指定的 GitHub release。
753
+ *
754
+ * 当值为字符串时,其为 release 的tagName。
755
+ *
756
+ * @default "release"
757
+ */
758
+ updater: string | false;
759
+ /**
760
+ * Comment to issues and prs inlcuded in release.
761
+ *
762
+ * @todo Not implemented yet
763
+ *
764
+ * @default false
765
+ */
766
+ comment: boolean;
767
+ releaseNote: (ctx: Context) => string;
768
+ };
769
+ hooks: Partial<ReleaseHooks>;
770
+ }
771
+ interface ReleaseHooks {
772
+ "release:init": (ctx: Context) => void | Promise<void>;
773
+ "release:push": (ctx: Context) => void | Promise<void>;
774
+ "release:done": (ctx: Context) => void | Promise<void>;
775
+ }
776
+ interface TestConfig {
777
+ /**
778
+ * The test source code directories, starting from the root directory of the project.
779
+ * All `*.spec.js` files in these directories will be executed.
780
+ * The files will be sorted by alphabetical order.
781
+ *
782
+ * 测试源码目录,从项目的根目录开始。
783
+ * 这些目录中的所有 `*.spec.js` 文件将被执行。
784
+ * 文件将按字母顺序排序。
785
+ *
786
+ * @default "test"
787
+ */
788
+ entries: string | string[];
789
+ /**
790
+ * The default preferences for the test.
791
+ * These preferences will be set before the test starts.
792
+ *
793
+ * 测试的默认首选项。
794
+ * 这些首选项将在测试开始前设置。
795
+ */
796
+ prefs: Record<string, string | boolean | number>;
797
+ mocha: {
798
+ /**
799
+ * The timeout of the test.
800
+ *
801
+ * 测试的超时时间。
802
+ *
803
+ * @default 10000
804
+ */
805
+ timeout: number;
806
+ };
807
+ /**
808
+ * Abort the test when the first test fails.
809
+ *
810
+ * 当第一个测试失败时中止测试。
811
+ *
812
+ * @default false
813
+ */
814
+ abortOnFail: boolean;
815
+ /**
816
+ * Watch source and test file changes,
817
+ * and re-run tests when files change.
818
+ *
819
+ * If this set to false, Zotero will exit
820
+ * when test complated.
821
+ *
822
+ * 当源码或测试代码变更时自动重新运行测试。
823
+ *
824
+ * 若此选项设置为 false,Zotero 将在测试结束后立即退出。
825
+ *
826
+ * @default true (false in ci)
827
+ */
828
+ watch: boolean;
829
+ /**
830
+ * Run Zotero in deadless mode.
831
+ *
832
+ * - Supported for Linux only.
833
+ * - Default to true when in CI environments.
834
+ *
835
+ * 使用无头模式运行 Zotero。
836
+ *
837
+ * - 仅支持 Linux
838
+ * - 在 CI 模式下,默认为 true
839
+ *
840
+ * @default false (true in ci)
841
+ */
842
+ headless: boolean;
843
+ /**
844
+ * The delay time before running the test. Make sure the plugin is fully loaded before running the test.
845
+ *
846
+ * 运行测试前的延迟时间。确保插件在运行测试前完全加载。
847
+ *
848
+ * @default 1000
849
+ */
850
+ startupDelay: number;
851
+ /**
852
+ * Function string that returns the initialization status of the plugin.
853
+ *
854
+ * If set, the test will wait until the function returns true before running the test.
855
+ *
856
+ * 返回插件初始化状态的函数字符串。
857
+ *
858
+ * 如果设置,测试将等待函数返回 true 后再运行测试。
859
+ *
860
+ * @default "() => true"
861
+ *
862
+ * @example
863
+ * ```js
864
+ * () => !!Zotero.BetterNotes.data.initialized
865
+ * ```
866
+ */
867
+ waitForPlugin: string;
868
+ hooks: Partial<TestHooks>;
869
+ }
870
+ interface TestHooks {
871
+ "test:init": (ctx: Context) => void | Promise<void>;
872
+ "test:prebuild": (ctx: Context) => void | Promise<void>;
873
+ "test:bundleTests": (ctx: Context) => void | Promise<void>;
874
+ "test:run": (ctx: Context) => void | Promise<void>;
875
+ "test:exit": (ctx: Context) => void;
876
+ }
877
+ interface Hooks extends BuildHooks, ServeHooks, ReleaseHooks, TestHooks {}
878
+ //#endregion
879
+ //#region src/types/utils.d.ts
880
+ type RecursivePartial<T> = { [P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P]; };
881
+ //#endregion
882
+ //#region src/types/index.d.ts
883
+ /**
884
+ * User config
885
+ */
886
+ interface UserConfig extends RecursivePartial<Config> {}
887
+ interface OverrideConfig extends RecursivePartial<Config> {}
888
+ interface Context extends Config {
889
+ pkgUser: any;
890
+ version: string;
891
+ hooks: Hookable<Hooks>;
892
+ logger: Logger;
893
+ templateData: TemplateData;
894
+ }
895
+ interface TemplateData {
896
+ /**
897
+ * `owner` and `repo` will be extracted from the `repository` property in `package.json`.
898
+ */
899
+ owner: string;
900
+ repo: string;
901
+ version: string;
902
+ isPreRelease: string;
903
+ updateJson: "update-beta.json" | "update.json" | string;
904
+ xpiName: string;
905
+ buildTime: string;
906
+ }
907
+ //#endregion
908
+ export { Logger as i, OverrideConfig as n, UserConfig as r, Context as t };