zotero-plugin-scaffold 0.1.0-beta.2 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,23 @@
1
1
  # Zotero Plugin Development Scaffold
2
2
 
3
- Working in progress.
3
+ [![NPM Version](https://img.shields.io/npm/v/zotero-plugin-scaffold)](https://www.npmjs.com/package/zotero-plugin-scaffold)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/zotero-plugin-scaffold)](https://www.npmjs.com/package/zotero-plugin-scaffold)
5
+ ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/zotero-plugin-scaffold)
6
+ ![GitHub License](https://img.shields.io/github/license/northword/zotero-plugin-scaffold)
4
7
 
5
- Create a standalone npm package for scripts in the zotero-plugin-template repository, so that downstream developers can follow along.
8
+ This is an npm package designed to assist in the development of Zotero plugins. It provides features such as compiling plugins, starting Zotero and installing plugins from source code, reloading plugins when the source code changes, and releasing plugins, and so on.
6
9
 
7
- This repository serves only as a proof-of-concept for the above.
10
+ Initially, the code of this package was part of the [zotero-plugin-template](https://github.com/windingwind/zotero-plugin-template) repository. To allow downstream developers to easily stay up-to-date, we have abstracted these scripts into a standalone npm package.
11
+
12
+ This project is under active development, and some APIs may change. However, it is ready for production and has been [used in several projects](https://github.com/northword/zotero-plugin-scaffold/network/dependents).
13
+
14
+ For best practices regarding this package, please refer to [zotero-plugin-template](https://github.com/windingwind/zotero-plugin-template).
8
15
 
9
16
  ## Using in a blank project
10
17
 
11
- > WIP: Not yet implemented
18
+ <details>
19
+
20
+ <summary>WIP: Not yet implemented</summary>
12
21
 
13
22
  ```bash
14
23
  # npm
@@ -17,6 +26,8 @@ npx zotero-plugin create
17
26
  pnpm dlx zotero-plugin create
18
27
  ```
19
28
 
29
+ </details>
30
+
20
31
  ## Using in an existing project
21
32
 
22
33
  ### 01. Install
@@ -49,28 +60,25 @@ pnpm link ../zotero-plugin-scaffold
49
60
 
50
61
  ### 02. Create a config file
51
62
 
52
- The configuration file needs to be stored in the following location. If the configuration file is not found, an error will be thrown.
63
+ The configuration file needs to be stored in the following location.
53
64
 
54
65
  ```bash
55
66
  zotero-plugin.config.ts # also avaliable in *.js *.mjs *.cjs *.ts
56
67
  ```
57
68
 
58
- You can import `defineConfig` in js module to get type hints. If no value is specified for an optional property, the default value will be used.
69
+ You can import helper `defineConfig` to get type hints. If no value is specified for an optional property, the default value will be used.
59
70
 
60
71
  ```ts
61
72
  import { defineConfig } from "zotero-plugin-scaffold";
62
73
 
63
74
  export default defineConfig({
64
- name: pkg.config.addonName,
65
- id: pkg.config.addonID,
66
- namespace: pkg.config.addonRef,
75
+ name: "the plugin name",
76
+ id: "the plugin id",
77
+ namespace: "the plugin namespace",
67
78
  build: {
68
79
  esbuildOptions: [
69
80
  {
70
81
  entryPoints: ["src/index.ts"],
71
- define: {
72
- __env__: `"${process.env.NODE_ENV}"`,
73
- },
74
82
  bundle: true,
75
83
  target: "firefox115",
76
84
  },
@@ -93,8 +101,7 @@ NOTE: Do not check-in this file to the repository!
93
101
 
94
102
  ```ini
95
103
  # The path of the Zotero binary file.
96
- # The path delimiter should be escaped as `\\` for win32.
97
- # The path is `*/Zotero.app/Contents/MacOS/zotero` for MacOS.
104
+ # The path is `*/Zotero.app/Contents/MacOS/zotero` for macOS.
98
105
  ZOTERO_PLUGIN_ZOTERO_BIN_PATH = /path/to/zotero.exe
99
106
 
100
107
  # The path of the profile used for development.
@@ -144,13 +151,14 @@ cd zotero-plugin-scaffold/
144
151
  pnpm install
145
152
 
146
153
  # Development Mode
147
- # This command creates a js runtime using jiti, and the modified code does not need to be built again.
154
+ # This command creates a typescript runtime using jiti,
155
+ # and the modified code does not need to be built again.
148
156
  pnpm run dev
149
157
 
150
158
  # Build
151
159
  pnpm run build
152
160
 
153
- # Lint and Prettier
161
+ # ES Lint
154
162
  pnpm run lint:fix
155
163
  ```
156
164
 
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { exit, env } from 'node:process';
3
3
  import { Command } from 'commander';
4
4
  import updateNotifier from 'update-notifier';
5
- import { L as Log, C as Config, B as Build, S as Serve, R as Release } from './shared/zotero-plugin-scaffold.125bc4ce.mjs';
5
+ import { L as Log, C as Config, B as Build, S as Serve, R as Release } from './shared/zotero-plugin-scaffold.7ad797c4.mjs';
6
6
  import 'node:path';
7
7
  import 'c12';
8
8
  import 'fs-extra';
@@ -25,7 +25,7 @@ import 'chokidar';
25
25
  import 'node:fs';
26
26
 
27
27
  const name = "zotero-plugin-scaffold";
28
- const version = "0.1.0-beta.2";
28
+ const version = "0.1.0-beta.3";
29
29
 
30
30
  const logger = new Log();
31
31
  async function main() {
package/dist/index.d.mts CHANGED
@@ -322,7 +322,7 @@ interface ServerConfig {
322
322
  /**
323
323
  * 启动 Zotero 时附加的命令行参数
324
324
  *
325
- * @default ["--purgecaches"]
325
+ * @default []
326
326
  */
327
327
  startArgs: string[];
328
328
  /**
package/dist/index.d.ts CHANGED
@@ -322,7 +322,7 @@ interface ServerConfig {
322
322
  /**
323
323
  * 启动 Zotero 时附加的命令行参数
324
324
  *
325
- * @default ["--purgecaches"]
325
+ * @default []
326
326
  */
327
327
  startArgs: string[];
328
328
  /**
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { B as Build, C as Config, R as Release, S as Serve, d as defineConfig } from './shared/zotero-plugin-scaffold.125bc4ce.mjs';
1
+ export { B as Build, C as Config, R as Release, S as Serve, d as defineConfig } from './shared/zotero-plugin-scaffold.7ad797c4.mjs';
2
2
  import 'node:path';
3
3
  import 'c12';
4
4
  import 'fs-extra';
@@ -911,19 +911,25 @@ class Release extends Base {
911
911
  const currentTagIndex = tags.indexOf(currentTag);
912
912
  if (currentTagIndex === -1)
913
913
  throw new Error(`Tag "${currentTag}" not found.`);
914
+ let previousTagIndex = currentTagIndex - 1;
915
+ let previousTag;
914
916
  if (currentTagIndex === 0) {
915
- return execSync(`git log ${currentTag} --pretty=format:"* %s (%h)"`).toString().trim();
917
+ previousTag = false;
918
+ } else if (currentTag.includes("-")) {
919
+ previousTag = tags[previousTagIndex];
916
920
  } else {
917
- let previousTagIndex = currentTagIndex - 1;
918
921
  while (previousTagIndex >= 0 && tags[previousTagIndex].includes("-")) {
919
922
  previousTagIndex--;
920
923
  }
921
- if (previousTagIndex < 0) {
922
- return execSync(`git log ${currentTag} --pretty=format:"* %s (%h)"`).toString().trim();
923
- }
924
- const previousTag = tags[previousTagIndex];
925
- return execSync(`git log ${previousTag}..${currentTag} --pretty=format:"* %s (%h)"`).toString().trim();
924
+ if (previousTagIndex < 0)
925
+ previousTag = false;
926
+ else
927
+ previousTag = tags[previousTagIndex];
926
928
  }
929
+ if (previousTag)
930
+ return execSync(`git log --pretty=format:"* %s (%h)" ${previousTag}..${currentTag}`).toString().trim();
931
+ else
932
+ return execSync(`git log --pretty=format:"* %s (%h)" ${currentTag}`).toString().trim();
927
933
  }
928
934
  getFilteredChangelog(rawLog, commitMessage) {
929
935
  const filterRegex = new RegExp(escapeRegExp(commitMessage));
@@ -946,7 +952,8 @@ class Release extends Base {
946
952
  changelog = this.getFilteredChangelog(rawLog, resolvedCommitMessage);
947
953
  }
948
954
  this.logger.debug(`Got changelog:
949
- `, changelog, "\n");
955
+ ${changelog}
956
+ `);
950
957
  return changelog;
951
958
  }
952
959
  isEnabled(enable) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zotero-plugin-scaffold",
3
3
  "type": "module",
4
- "version": "0.1.0-beta.2",
4
+ "version": "0.1.0-beta.3",
5
5
  "description": "A scaffold for Zotero plugin development.",
6
6
  "author": "northword",
7
7
  "license": "AGPL-3.0-or-later",
@@ -51,34 +51,34 @@
51
51
  "doc": "docs"
52
52
  },
53
53
  "dependencies": {
54
- "@inquirer/prompts": "5.3.6",
55
- "bumpp": "9.4.1",
56
- "c12": "1.11.1",
57
- "chalk": "5.3.0",
58
- "chokidar": "3.6.0",
59
- "commander": "12.1.0",
60
- "conventional-changelog": "6.0.0",
54
+ "@inquirer/prompts": "^5.3.8",
55
+ "bumpp": "^9.5.2",
56
+ "c12": "^1.11.1",
57
+ "chalk": "^5.3.0",
58
+ "chokidar": "^3.6.0",
59
+ "commander": "^12.1.0",
60
+ "conventional-changelog": "^6.0.0",
61
61
  "es-toolkit": "^1.16.0",
62
- "esbuild": "0.23.0",
63
- "fs-extra": "11.2.0",
62
+ "esbuild": "^0.23.1",
63
+ "fs-extra": "^11.2.0",
64
64
  "globby": "^14.0.2",
65
- "hookable": "5.5.3",
66
- "mime": "4.0.4",
67
- "octokit": "4.0.2",
68
- "replace-in-file": "8.1.0",
69
- "std-env": "3.7.0",
70
- "update-notifier": "7.1.0",
71
- "web-ext": "8.2.0"
65
+ "hookable": "^5.5.3",
66
+ "mime": "^4.0.4",
67
+ "octokit": "^4.0.2",
68
+ "replace-in-file": "^8.1.0",
69
+ "std-env": "^3.7.0",
70
+ "update-notifier": "^7.2.0",
71
+ "web-ext": "^8.2.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@antfu/eslint-config": "^2.23.0",
75
- "@types/fs-extra": "11.0.4",
76
- "@types/node": "20.14.13",
77
- "@types/update-notifier": "6.0.8",
78
- "eslint": "9.8.0",
74
+ "@antfu/eslint-config": "^2.27.1",
75
+ "@types/fs-extra": "^11.0.4",
76
+ "@types/node": "^20.16.1",
77
+ "@types/update-notifier": "^6.0.8",
78
+ "eslint": "^9.9.1",
79
79
  "eslint-plugin-format": "^0.1.2",
80
- "typescript": "5.5.4",
81
- "unbuild": "2.0.0"
80
+ "typescript": "^5.5.4",
81
+ "unbuild": "^2.0.0"
82
82
  },
83
83
  "scripts": {
84
84
  "dev": "unbuild --stub",