zotero-plugin-scaffold 0.0.24 → 0.0.26
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 +12 -13
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +33 -29
- package/package.json +11 -12
package/dist/cli.mjs
CHANGED
|
@@ -24,14 +24,15 @@ import 'chokidar';
|
|
|
24
24
|
import 'process';
|
|
25
25
|
|
|
26
26
|
const name = "zotero-plugin-scaffold";
|
|
27
|
-
const version = "0.0.
|
|
27
|
+
const version = "0.0.26";
|
|
28
28
|
const description = "A scaffold for Zotero plugin development.";
|
|
29
29
|
const scripts = {
|
|
30
30
|
dev: "unbuild --stub",
|
|
31
31
|
build: "tsc --noEmit && unbuild",
|
|
32
|
-
lint: "eslint
|
|
33
|
-
"lint:fix": "eslint --fix .
|
|
32
|
+
lint: "eslint . & prettier --check .",
|
|
33
|
+
"lint:fix": "eslint --fix . & prettier --write .",
|
|
34
34
|
release: "bumpp --commit \"chore(release): publish v%s\"",
|
|
35
|
+
"update:deps": "pnpx taze minor -w -f -l",
|
|
35
36
|
test: "echo \"Error: no test specified\" && exit 1"
|
|
36
37
|
};
|
|
37
38
|
const type = "module";
|
|
@@ -78,27 +79,27 @@ const directories = {
|
|
|
78
79
|
const engines = {
|
|
79
80
|
node: ">=18"
|
|
80
81
|
};
|
|
81
|
-
const packageManager = "pnpm@9.1.
|
|
82
|
+
const packageManager = "pnpm@9.1.3";
|
|
82
83
|
const dependencies = {
|
|
83
|
-
"@inquirer/prompts": "5.0.
|
|
84
|
+
"@inquirer/prompts": "5.0.4",
|
|
84
85
|
bumpp: "9.4.1",
|
|
85
86
|
c12: "1.10.0",
|
|
86
87
|
chalk: "5.3.0",
|
|
87
88
|
chokidar: "3.6.0",
|
|
88
|
-
commander: "12.
|
|
89
|
+
commander: "12.1.0",
|
|
89
90
|
consola: "3.2.3",
|
|
90
91
|
"conventional-changelog": "6.0.0",
|
|
91
|
-
esbuild: "0.21.
|
|
92
|
+
esbuild: "0.21.4",
|
|
92
93
|
"fast-glob": "3.3.2",
|
|
93
94
|
"fs-extra": "11.2.0",
|
|
94
95
|
hookable: "5.5.3",
|
|
95
96
|
mime: "4.0.3",
|
|
96
97
|
octokit: "4.0.2",
|
|
97
98
|
radash: "12.1.0",
|
|
98
|
-
"replace-in-file": "7.
|
|
99
|
+
"replace-in-file": "7.2.0",
|
|
99
100
|
"std-env": "3.7.0",
|
|
100
101
|
"update-notifier": "7.0.0",
|
|
101
|
-
"web-ext": "7.
|
|
102
|
+
"web-ext": "7.12.0"
|
|
102
103
|
};
|
|
103
104
|
const devDependencies = {
|
|
104
105
|
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
@@ -106,12 +107,10 @@ const devDependencies = {
|
|
|
106
107
|
"@types/fs-extra": "11.0.4",
|
|
107
108
|
"@types/node": "20.12.12",
|
|
108
109
|
"@types/update-notifier": "6.0.8",
|
|
109
|
-
|
|
110
|
-
"@typescript-eslint/parser": "7.9.0",
|
|
111
|
-
eslint: "8.57.0",
|
|
112
|
-
"eslint-config-prettier": "9.1.0",
|
|
110
|
+
eslint: "9.3.0",
|
|
113
111
|
prettier: "3.2.5",
|
|
114
112
|
typescript: "5.4.5",
|
|
113
|
+
"typescript-eslint": "8.0.0-alpha.20",
|
|
115
114
|
unbuild: "2.0.0"
|
|
116
115
|
};
|
|
117
116
|
const pnpm = {
|
package/dist/index.d.mts
CHANGED
|
@@ -649,7 +649,7 @@ declare class Release extends Base {
|
|
|
649
649
|
starred_at?: string | undefined;
|
|
650
650
|
} | null;
|
|
651
651
|
}>;
|
|
652
|
-
|
|
652
|
+
refreshUpdateManifest(): Promise<void>;
|
|
653
653
|
getChangelog(): Promise<string>;
|
|
654
654
|
getClient(): Octokit;
|
|
655
655
|
get owner(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -649,7 +649,7 @@ declare class Release extends Base {
|
|
|
649
649
|
starred_at?: string | undefined;
|
|
650
650
|
} | null;
|
|
651
651
|
}>;
|
|
652
|
-
|
|
652
|
+
refreshUpdateManifest(): Promise<void>;
|
|
653
653
|
getChangelog(): Promise<string>;
|
|
654
654
|
getClient(): Octokit;
|
|
655
655
|
get owner(): string;
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { isCI, isWindows, isMacOS, isLinux } from 'std-env';
|
|
|
5
5
|
import { loadConfig as loadConfig$1 } from 'c12';
|
|
6
6
|
import fs from 'fs-extra';
|
|
7
7
|
import { createHooks } from 'hookable';
|
|
8
|
-
import path from 'path';
|
|
8
|
+
import path, { join, basename } from 'path';
|
|
9
9
|
import { dash, template, assign, debounce } from 'radash';
|
|
10
10
|
import * as crypto from 'crypto';
|
|
11
11
|
import { buildSync } from 'esbuild';
|
|
@@ -376,7 +376,7 @@ class Build extends Base {
|
|
|
376
376
|
const MessagesInHTML = /* @__PURE__ */ new Set();
|
|
377
377
|
replaceInFile.sync({
|
|
378
378
|
files: [`${this.dist}/addon/**/*.xhtml`, `${this.dist}/addon/**/*.html`],
|
|
379
|
-
// @ts-
|
|
379
|
+
// @ts-ignore ReplaceInFileConfig has processor
|
|
380
380
|
processor: (input) => {
|
|
381
381
|
const matchs = [...input.matchAll(/(data-l10n-id)="(\S*)"/g)];
|
|
382
382
|
matchs.map((match) => {
|
|
@@ -404,7 +404,7 @@ class Build extends Base {
|
|
|
404
404
|
const MessageInThisLang = /* @__PURE__ */ new Set();
|
|
405
405
|
replaceInFile.sync({
|
|
406
406
|
files: [`${this.dist}/addon/locale/${localeName}/**/*.ftl`],
|
|
407
|
-
// @ts-
|
|
407
|
+
// @ts-ignore ReplaceInFileConfig has processor
|
|
408
408
|
processor: (fltContent) => {
|
|
409
409
|
const lines = fltContent.split("\n");
|
|
410
410
|
const prefixedLines = lines.map((line) => {
|
|
@@ -466,7 +466,8 @@ class Build extends Base {
|
|
|
466
466
|
}
|
|
467
467
|
};
|
|
468
468
|
fs.writeJsonSync(`${this.dist}/update-beta.json`, data, { spaces: 2 });
|
|
469
|
-
!this.isPreRelease
|
|
469
|
+
if (!this.isPreRelease)
|
|
470
|
+
fs.writeJsonSync(`${this.dist}/update.json`, data, { spaces: 2 });
|
|
470
471
|
this.logger.log(
|
|
471
472
|
`Prepare Update.json for ${this.isPreRelease ? "\x1B[31m Prerelease \x1B[0m" : "\x1B[32m Release \x1B[0m"}`
|
|
472
473
|
);
|
|
@@ -516,7 +517,7 @@ class Release extends Base {
|
|
|
516
517
|
this.logger.info("Uploading XPI...");
|
|
517
518
|
await this.uploadXPI();
|
|
518
519
|
this.logger.info("Uploading update manifest...");
|
|
519
|
-
await this.
|
|
520
|
+
await this.refreshUpdateManifest();
|
|
520
521
|
}
|
|
521
522
|
this.logger.success(
|
|
522
523
|
`Done in ${(( new Date()).getTime() - t.getTime()) / 1e3} s.`
|
|
@@ -528,7 +529,9 @@ class Release extends Base {
|
|
|
528
529
|
* release: bump version, run build, git add, git commit, git tag, git push
|
|
529
530
|
*/
|
|
530
531
|
async bump() {
|
|
531
|
-
await versionBump(this.ctx.release.bumpp);
|
|
532
|
+
const result = await versionBump(this.ctx.release.bumpp);
|
|
533
|
+
this.ctx.version = result.newVersion;
|
|
534
|
+
this.ctx.release.bumpp.tag = result.tag;
|
|
532
535
|
}
|
|
533
536
|
/**
|
|
534
537
|
* Create new release and upload XPI to asset
|
|
@@ -537,7 +540,7 @@ class Release extends Base {
|
|
|
537
540
|
const release = await this.creatRelease({
|
|
538
541
|
owner: this.owner,
|
|
539
542
|
repo: this.repo,
|
|
540
|
-
tag_name:
|
|
543
|
+
tag_name: this.ctx.release.bumpp.tag.toString().replaceAll("%s", this.version),
|
|
541
544
|
name: `Release v${this.version}`,
|
|
542
545
|
body: await this.getChangelog(),
|
|
543
546
|
prerelease: this.version.includes("-"),
|
|
@@ -546,10 +549,7 @@ class Release extends Base {
|
|
|
546
549
|
if (!release)
|
|
547
550
|
throw new Error("Create release failed!");
|
|
548
551
|
this.logger.debug("Uploading xpi asset...");
|
|
549
|
-
await this.uploadAsset(
|
|
550
|
-
release.id,
|
|
551
|
-
path.join(this.dist, `${this.xpiName}.xpi`)
|
|
552
|
-
);
|
|
552
|
+
await this.uploadAsset(release.id, join(this.dist, `${this.xpiName}.xpi`));
|
|
553
553
|
}
|
|
554
554
|
async getReleaseByTag(tag) {
|
|
555
555
|
return await this.client.rest.repos.getReleaseByTag({
|
|
@@ -586,30 +586,22 @@ class Release extends Base {
|
|
|
586
586
|
"content-type": mime.getType(asset) || "application/octet-stream",
|
|
587
587
|
"content-length": fs.statSync(asset).size
|
|
588
588
|
},
|
|
589
|
-
name:
|
|
589
|
+
name: basename(asset)
|
|
590
590
|
}).then((res) => {
|
|
591
591
|
return res.data;
|
|
592
592
|
});
|
|
593
593
|
}
|
|
594
|
-
async
|
|
595
|
-
const assets =
|
|
594
|
+
async refreshUpdateManifest() {
|
|
595
|
+
const assets = glob.globSync(`${this.dist}/*.json`).map((p) => basename(p));
|
|
596
596
|
const release = await this.getReleaseByTag("release") ?? await this.creatRelease({
|
|
597
597
|
owner: this.owner,
|
|
598
598
|
repo: this.repo,
|
|
599
599
|
tag_name: "release",
|
|
600
|
+
prerelease: true,
|
|
600
601
|
make_latest: "false"
|
|
601
602
|
});
|
|
602
603
|
if (!release)
|
|
603
604
|
throw new Error("Get or create 'release' failed.");
|
|
604
|
-
await this.client.rest.repos.updateRelease({
|
|
605
|
-
owner: this.owner,
|
|
606
|
-
repo: this.repo,
|
|
607
|
-
release_id: release.id,
|
|
608
|
-
name: "Release Manifest",
|
|
609
|
-
body: `This release is used to host \`update.json\`, please do not delete or modify it!
|
|
610
|
-
Updated in UTC ${( new Date()).toISOString()} for version ${this.version}`,
|
|
611
|
-
make_latest: "false"
|
|
612
|
-
});
|
|
613
605
|
const existAssets = await this.client.rest.repos.listReleaseAssets({
|
|
614
606
|
owner: this.owner,
|
|
615
607
|
repo: this.repo,
|
|
@@ -619,16 +611,28 @@ class Release extends Base {
|
|
|
619
611
|
});
|
|
620
612
|
if (existAssets) {
|
|
621
613
|
for (const existAsset of existAssets) {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
614
|
+
if (assets.includes(existAsset.name)) {
|
|
615
|
+
await this.client.rest.repos.deleteReleaseAsset({
|
|
616
|
+
owner: this.owner,
|
|
617
|
+
repo: this.repo,
|
|
618
|
+
asset_id: existAsset.id
|
|
619
|
+
});
|
|
620
|
+
}
|
|
627
621
|
}
|
|
628
622
|
}
|
|
629
623
|
for (const asset of assets) {
|
|
630
|
-
await this.uploadAsset(release.id,
|
|
624
|
+
await this.uploadAsset(release.id, join(this.dist, asset));
|
|
631
625
|
}
|
|
626
|
+
await this.client.rest.repos.updateRelease({
|
|
627
|
+
owner: this.owner,
|
|
628
|
+
repo: this.repo,
|
|
629
|
+
release_id: release.id,
|
|
630
|
+
name: "Release Manifest",
|
|
631
|
+
body: `This release is used to host \`update.json\`, please do not delete or modify it!
|
|
632
|
+
Updated in UTC ${( new Date()).toISOString()} for version ${this.version}`,
|
|
633
|
+
prerelease: true,
|
|
634
|
+
make_latest: "false"
|
|
635
|
+
});
|
|
632
636
|
}
|
|
633
637
|
getChangelog() {
|
|
634
638
|
return new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin-scaffold",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "A scaffold for Zotero plugin development.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -47,25 +47,25 @@
|
|
|
47
47
|
"node": ">=18"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@inquirer/prompts": "5.0.
|
|
50
|
+
"@inquirer/prompts": "5.0.4",
|
|
51
51
|
"bumpp": "9.4.1",
|
|
52
52
|
"c12": "1.10.0",
|
|
53
53
|
"chalk": "5.3.0",
|
|
54
54
|
"chokidar": "3.6.0",
|
|
55
|
-
"commander": "12.
|
|
55
|
+
"commander": "12.1.0",
|
|
56
56
|
"consola": "3.2.3",
|
|
57
57
|
"conventional-changelog": "6.0.0",
|
|
58
|
-
"esbuild": "0.21.
|
|
58
|
+
"esbuild": "0.21.4",
|
|
59
59
|
"fast-glob": "3.3.2",
|
|
60
60
|
"fs-extra": "11.2.0",
|
|
61
61
|
"hookable": "5.5.3",
|
|
62
62
|
"mime": "4.0.3",
|
|
63
63
|
"octokit": "4.0.2",
|
|
64
64
|
"radash": "12.1.0",
|
|
65
|
-
"replace-in-file": "7.
|
|
65
|
+
"replace-in-file": "7.2.0",
|
|
66
66
|
"std-env": "3.7.0",
|
|
67
67
|
"update-notifier": "7.0.0",
|
|
68
|
-
"web-ext": "7.
|
|
68
|
+
"web-ext": "7.12.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
@@ -73,20 +73,19 @@
|
|
|
73
73
|
"@types/fs-extra": "11.0.4",
|
|
74
74
|
"@types/node": "20.12.12",
|
|
75
75
|
"@types/update-notifier": "6.0.8",
|
|
76
|
-
"
|
|
77
|
-
"@typescript-eslint/parser": "7.9.0",
|
|
78
|
-
"eslint": "8.57.0",
|
|
79
|
-
"eslint-config-prettier": "9.1.0",
|
|
76
|
+
"eslint": "9.3.0",
|
|
80
77
|
"prettier": "3.2.5",
|
|
81
78
|
"typescript": "5.4.5",
|
|
79
|
+
"typescript-eslint": "8.0.0-alpha.20",
|
|
82
80
|
"unbuild": "2.0.0"
|
|
83
81
|
},
|
|
84
82
|
"scripts": {
|
|
85
83
|
"dev": "unbuild --stub",
|
|
86
84
|
"build": "tsc --noEmit && unbuild",
|
|
87
|
-
"lint": "eslint
|
|
88
|
-
"lint:fix": "eslint --fix .
|
|
85
|
+
"lint": "eslint . & prettier --check .",
|
|
86
|
+
"lint:fix": "eslint --fix . & prettier --write .",
|
|
89
87
|
"release": "bumpp --commit \"chore(release): publish v%s\"",
|
|
88
|
+
"update:deps": "pnpx taze minor -w -f -l",
|
|
90
89
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
91
90
|
}
|
|
92
91
|
}
|