zotero-plugin-scaffold 0.0.24 → 0.0.27

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 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.24";
27
+ const version = "0.0.27";
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 --max-warnings=0 . && prettier --check .",
33
- "lint:fix": "eslint --fix . && prettier --write .",
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.1";
82
+ const packageManager = "pnpm@9.1.3";
82
83
  const dependencies = {
83
- "@inquirer/prompts": "5.0.3",
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.0.0",
89
+ commander: "12.1.0",
89
90
  consola: "3.2.3",
90
91
  "conventional-changelog": "6.0.0",
91
- esbuild: "0.21.2",
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.1.0",
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.11.0"
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
- "@typescript-eslint/eslint-plugin": "7.9.0",
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
- uploadUpdateJSON(): Promise<void>;
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
- uploadUpdateJSON(): Promise<void>;
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';
@@ -84,6 +84,7 @@ async function loadConfig(overrides) {
84
84
  const result = await loadConfig$1({
85
85
  name: "zotero-plugin",
86
86
  dotenv: true,
87
+ packageJson: true,
87
88
  defaults: getDefaultConfig(),
88
89
  overrides
89
90
  });
@@ -376,7 +377,7 @@ class Build extends Base {
376
377
  const MessagesInHTML = /* @__PURE__ */ new Set();
377
378
  replaceInFile.sync({
378
379
  files: [`${this.dist}/addon/**/*.xhtml`, `${this.dist}/addon/**/*.html`],
379
- // @ts-expect-error ReplaceInFileConfig has processor
380
+ // @ts-ignore ReplaceInFileConfig has processor
380
381
  processor: (input) => {
381
382
  const matchs = [...input.matchAll(/(data-l10n-id)="(\S*)"/g)];
382
383
  matchs.map((match) => {
@@ -404,7 +405,7 @@ class Build extends Base {
404
405
  const MessageInThisLang = /* @__PURE__ */ new Set();
405
406
  replaceInFile.sync({
406
407
  files: [`${this.dist}/addon/locale/${localeName}/**/*.ftl`],
407
- // @ts-expect-error ReplaceInFileConfig has processor
408
+ // @ts-ignore ReplaceInFileConfig has processor
408
409
  processor: (fltContent) => {
409
410
  const lines = fltContent.split("\n");
410
411
  const prefixedLines = lines.map((line) => {
@@ -466,7 +467,8 @@ class Build extends Base {
466
467
  }
467
468
  };
468
469
  fs.writeJsonSync(`${this.dist}/update-beta.json`, data, { spaces: 2 });
469
- !this.isPreRelease ? fs.writeJsonSync(`${this.dist}/update.json`, data, { spaces: 2 }) : "pass";
470
+ if (!this.isPreRelease)
471
+ fs.writeJsonSync(`${this.dist}/update.json`, data, { spaces: 2 });
470
472
  this.logger.log(
471
473
  `Prepare Update.json for ${this.isPreRelease ? "\x1B[31m Prerelease \x1B[0m" : "\x1B[32m Release \x1B[0m"}`
472
474
  );
@@ -516,7 +518,7 @@ class Release extends Base {
516
518
  this.logger.info("Uploading XPI...");
517
519
  await this.uploadXPI();
518
520
  this.logger.info("Uploading update manifest...");
519
- await this.uploadUpdateJSON();
521
+ await this.refreshUpdateManifest();
520
522
  }
521
523
  this.logger.success(
522
524
  `Done in ${(( new Date()).getTime() - t.getTime()) / 1e3} s.`
@@ -528,7 +530,9 @@ class Release extends Base {
528
530
  * release: bump version, run build, git add, git commit, git tag, git push
529
531
  */
530
532
  async bump() {
531
- await versionBump(this.ctx.release.bumpp);
533
+ const result = await versionBump(this.ctx.release.bumpp);
534
+ this.ctx.version = result.newVersion;
535
+ this.ctx.release.bumpp.tag = result.tag;
532
536
  }
533
537
  /**
534
538
  * Create new release and upload XPI to asset
@@ -537,7 +541,7 @@ class Release extends Base {
537
541
  const release = await this.creatRelease({
538
542
  owner: this.owner,
539
543
  repo: this.repo,
540
- tag_name: `v${this.version}`,
544
+ tag_name: this.ctx.release.bumpp.tag.toString().replaceAll("%s", this.version),
541
545
  name: `Release v${this.version}`,
542
546
  body: await this.getChangelog(),
543
547
  prerelease: this.version.includes("-"),
@@ -546,10 +550,7 @@ class Release extends Base {
546
550
  if (!release)
547
551
  throw new Error("Create release failed!");
548
552
  this.logger.debug("Uploading xpi asset...");
549
- await this.uploadAsset(
550
- release.id,
551
- path.join(this.dist, `${this.xpiName}.xpi`)
552
- );
553
+ await this.uploadAsset(release.id, join(this.dist, `${this.xpiName}.xpi`));
553
554
  }
554
555
  async getReleaseByTag(tag) {
555
556
  return await this.client.rest.repos.getReleaseByTag({
@@ -586,30 +587,22 @@ class Release extends Base {
586
587
  "content-type": mime.getType(asset) || "application/octet-stream",
587
588
  "content-length": fs.statSync(asset).size
588
589
  },
589
- name: path.basename(asset)
590
+ name: basename(asset)
590
591
  }).then((res) => {
591
592
  return res.data;
592
593
  });
593
594
  }
594
- async uploadUpdateJSON() {
595
- const assets = ["update.json", "update-beta.json"];
595
+ async refreshUpdateManifest() {
596
+ const assets = glob.globSync(`${this.dist}/*.json`).map((p) => basename(p));
596
597
  const release = await this.getReleaseByTag("release") ?? await this.creatRelease({
597
598
  owner: this.owner,
598
599
  repo: this.repo,
599
600
  tag_name: "release",
601
+ prerelease: true,
600
602
  make_latest: "false"
601
603
  });
602
604
  if (!release)
603
605
  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
606
  const existAssets = await this.client.rest.repos.listReleaseAssets({
614
607
  owner: this.owner,
615
608
  repo: this.repo,
@@ -619,16 +612,28 @@ class Release extends Base {
619
612
  });
620
613
  if (existAssets) {
621
614
  for (const existAsset of existAssets) {
622
- await this.client.rest.repos.deleteReleaseAsset({
623
- owner: this.owner,
624
- repo: this.repo,
625
- asset_id: existAsset.id
626
- });
615
+ if (assets.includes(existAsset.name)) {
616
+ await this.client.rest.repos.deleteReleaseAsset({
617
+ owner: this.owner,
618
+ repo: this.repo,
619
+ asset_id: existAsset.id
620
+ });
621
+ }
627
622
  }
628
623
  }
629
624
  for (const asset of assets) {
630
- await this.uploadAsset(release.id, path.join(this.dist, asset));
625
+ await this.uploadAsset(release.id, join(this.dist, asset));
631
626
  }
627
+ await this.client.rest.repos.updateRelease({
628
+ owner: this.owner,
629
+ repo: this.repo,
630
+ release_id: release.id,
631
+ name: "Release Manifest",
632
+ body: `This release is used to host \`update.json\`, please do not delete or modify it!
633
+ Updated in UTC ${( new Date()).toISOString()} for version ${this.version}`,
634
+ prerelease: true,
635
+ make_latest: "false"
636
+ });
632
637
  }
633
638
  getChangelog() {
634
639
  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.24",
3
+ "version": "0.0.27",
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.3",
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.0.0",
55
+ "commander": "12.1.0",
56
56
  "consola": "3.2.3",
57
57
  "conventional-changelog": "6.0.0",
58
- "esbuild": "0.21.2",
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.1.0",
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.11.0"
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
- "@typescript-eslint/eslint-plugin": "7.9.0",
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 --max-warnings=0 . && prettier --check .",
88
- "lint:fix": "eslint --fix . && prettier --write .",
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
  }