fix(deps): bump ztoolkit, scaffold and other deps (#170)
* fix(deps): bump ztoolkit, scaffold and other deps - use web-ext to reload plugin - remove itembox example - update all deps * docs: add scaffold to readme and replace plugin dev documentation with zotero-chinese.com
This commit is contained in:
parent
351b732771
commit
d971407832
@ -25,5 +25,6 @@ ZOTERO_PLUGIN_DATA_DIR =
|
|||||||
# ZOTERO_PLUGIN_KILL_COMMAND =
|
# ZOTERO_PLUGIN_KILL_COMMAND =
|
||||||
|
|
||||||
# GitHub Token
|
# GitHub Token
|
||||||
# For release-it auto create release and upload assets
|
# For scaffold auto create release and upload assets.
|
||||||
|
# Fill in this variable if you are publishing locally instead of CI.
|
||||||
# GITHUB_TOKEN =
|
# GITHUB_TOKEN =
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -36,12 +36,6 @@ jobs:
|
|||||||
- name: Release to GitHub
|
- name: Release to GitHub
|
||||||
run: |
|
run: |
|
||||||
npm run release
|
npm run release
|
||||||
# cp build/update.json update.json
|
|
||||||
# cp build/update-beta.json update-beta.json
|
|
||||||
# git add update.json
|
|
||||||
# git add update-beta.json
|
|
||||||
# git commit -m 'chore(publish): synchronizing `update.json`'
|
|
||||||
# git push
|
|
||||||
sleep 1s
|
sleep 1s
|
||||||
|
|
||||||
- name: Notify release
|
- name: Notify release
|
||||||
|
20
README.md
20
README.md
@ -7,17 +7,15 @@ This is a plugin template for [Zotero](https://www.zotero.org/).
|
|||||||
|
|
||||||
[English](README.md) | [简体中文](doc/README-zhCN.md)
|
[English](README.md) | [简体中文](doc/README-zhCN.md)
|
||||||
|
|
||||||
[📖 Plugin Development Documentation](https://zotero.yuque.com/books/share/8d230829-6004-4934-b4c6-685a7001bfa0/vec88d) (Chinese, outdated)
|
- Documentation for plugins development
|
||||||
|
- [📖 Plugin Development Documentation](https://zotero-chinese.com/plugin-dev-guide/) (Chinese, not yet complete)
|
||||||
[📖 Plugin Development Documentation for Zotero 7](https://www.zotero.org/support/dev/zotero_7_for_developers)
|
- [📖 Plugin Development Documentation for Zotero 7](https://www.zotero.org/support/dev/zotero_7_for_developers)
|
||||||
|
- Tools for plugins development
|
||||||
[🛠️ Zotero Plugin Toolkit](https://github.com/windingwind/zotero-plugin-toolkit) | [API Documentation](https://github.com/windingwind/zotero-plugin-toolkit/blob/master/docs/zotero-plugin-toolkit.md)
|
- [🛠️ Zotero Plugin Toolkit](https://github.com/windingwind/zotero-plugin-toolkit) | [API Documentation](https://github.com/windingwind/zotero-plugin-toolkit/blob/master/docs/zotero-plugin-toolkit.md)
|
||||||
|
- [🛠️ Zotero Plugin Scaffold](https://github.com/northword/zotero-plugin-scaffold)
|
||||||
[ℹ️ Zotero Type Definitions](https://github.com/windingwind/zotero-types)
|
- [ℹ️ Zotero Type Definitions](https://github.com/windingwind/zotero-types)
|
||||||
|
- [📜 Zotero Source Code](https://github.com/zotero/zotero)
|
||||||
[📜 Zotero Source Code](https://github.com/zotero/zotero)
|
- [📌 Zotero Plugin Template](https://github.com/windingwind/zotero-plugin-template) (This repo)
|
||||||
|
|
||||||
[📌 Zotero Plugin Template](https://github.com/windingwind/zotero-plugin-template) (This repo)
|
|
||||||
|
|
||||||
> [!tip]
|
> [!tip]
|
||||||
> 👁 Watch this repo so that you can be notified whenever there are fixes & updates.
|
> 👁 Watch this repo so that you can be notified whenever there are fixes & updates.
|
||||||
|
@ -7,17 +7,15 @@
|
|||||||
|
|
||||||
[English](../README.md) | [简体中文](./README-zhCN.md)
|
[English](../README.md) | [简体中文](./README-zhCN.md)
|
||||||
|
|
||||||
📖 [插件开发文档](https://zotero.yuque.com/books/share/8d230829-6004-4934-b4c6-685a7001bfa0/vec88d) (中文版,已过时)
|
- 开发指南
|
||||||
|
- [📖 插件开发文档](https://zotero-chinese.com/plugin-dev-guide/) (中文版,尚不完善)
|
||||||
[📖 Zotero 7 插件开发文档](https://www.zotero.org/support/dev/zotero_7_for_developers)
|
- [📖 Zotero 7 插件开发文档](https://www.zotero.org/support/dev/zotero_7_for_developers)
|
||||||
|
- 开发工具参考
|
||||||
🛠️ [Zotero 插件工具包](https://github.com/windingwind/zotero-plugin-toolkit) | [API 文档](https://github.com/windingwind/zotero-plugin-toolkit/blob/master/docs/zotero-plugin-toolkit.md)
|
- [🛠️ Zotero 插件工具包](https://github.com/windingwind/zotero-plugin-toolkit) | [API 文档](https://github.com/windingwind/zotero-plugin-toolkit/blob/master/docs/zotero-plugin-toolkit.md)
|
||||||
|
- [🛠️ Zotero 插件开发脚手架](https://github.com/northword/zotero-plugin-scaffold)
|
||||||
ℹ️ [Zotero 类型定义](https://github.com/windingwind/zotero-types)
|
- [📜 Zotero 源代码](https://github.com/zotero/zotero)
|
||||||
|
- [ℹ️ Zotero 类型定义](https://github.com/windingwind/zotero-types)
|
||||||
📜 [Zotero 源代码](https://github.com/zotero/zotero)
|
- [📌 Zotero 插件模板](https://github.com/windingwind/zotero-plugin-template) (即本仓库)
|
||||||
|
|
||||||
📌 [Zotero 插件模板](https://github.com/windingwind/zotero-plugin-template) (即本仓库)
|
|
||||||
|
|
||||||
> [!tip]
|
> [!tip]
|
||||||
> 👁 Watch 本仓库,以及时收到修复或更新的通知.
|
> 👁 Watch 本仓库,以及时收到修复或更新的通知.
|
||||||
|
3203
package-lock.json
generated
3203
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -28,17 +28,17 @@
|
|||||||
"update-deps": "npm update --save"
|
"update-deps": "npm update --save"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"zotero-plugin-toolkit": "^2.3.31"
|
"zotero-plugin-toolkit": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.3.0",
|
"@eslint/js": "^9.9.1",
|
||||||
"@types/node": "^20.12.12",
|
"@types/node": "^22.5.0",
|
||||||
"eslint": "^9.3.0",
|
"eslint": "^9.9.1",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.3.3",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.5.4",
|
||||||
"typescript-eslint": "^8.0.0-alpha.20",
|
"typescript-eslint": "^8.3.0",
|
||||||
"zotero-plugin-scaffold": "^0.0.26",
|
"zotero-plugin-scaffold": "^0.1.0",
|
||||||
"zotero-types": "^2.0.0"
|
"zotero-types": "^2.1.1"
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
|
@ -68,8 +68,6 @@ async function onMainWindowLoad(win: Window): Promise<void> {
|
|||||||
|
|
||||||
UIExampleFactory.registerWindowMenuWithSeparator();
|
UIExampleFactory.registerWindowMenuWithSeparator();
|
||||||
|
|
||||||
await UIExampleFactory.registerCustomItemBoxRow();
|
|
||||||
|
|
||||||
PromptExampleFactory.registerNormalCommandExample();
|
PromptExampleFactory.registerNormalCommandExample();
|
||||||
|
|
||||||
PromptExampleFactory.registerAnonymousCommandExample();
|
PromptExampleFactory.registerAnonymousCommandExample();
|
||||||
|
@ -72,14 +72,12 @@ export class BasicExampleFactory {
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
static registerPrefs() {
|
static registerPrefs() {
|
||||||
const prefOptions = {
|
Zotero.PreferencePanes.register({
|
||||||
pluginID: config.addonID,
|
pluginID: config.addonID,
|
||||||
src: rootURI + "chrome/content/preferences.xhtml",
|
src: rootURI + "chrome/content/preferences.xhtml",
|
||||||
label: getString("prefs-title"),
|
label: getString("prefs-title"),
|
||||||
image: `chrome://${config.addonRef}/content/icons/favicon.png`,
|
image: `chrome://${config.addonRef}/content/icons/favicon.png`,
|
||||||
defaultXUL: true,
|
});
|
||||||
};
|
|
||||||
ztoolkit.PreferencePane.register(prefOptions);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,46 +226,6 @@ export class UIExampleFactory {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@example
|
|
||||||
static async registerCustomItemBoxRow() {
|
|
||||||
await ztoolkit.ItemBox.register(
|
|
||||||
"itemBoxFieldEditable",
|
|
||||||
"Editable Custom Field",
|
|
||||||
(field, unformatted, includeBaseMapped, item, original) => {
|
|
||||||
return (
|
|
||||||
ztoolkit.ExtraField.getExtraField(item, "itemBoxFieldEditable") || ""
|
|
||||||
);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
editable: true,
|
|
||||||
setFieldHook: (field, value, loadIn, item, original) => {
|
|
||||||
window.alert("Custom itemBox value is changed and saved to extra!");
|
|
||||||
ztoolkit.ExtraField.setExtraField(
|
|
||||||
item,
|
|
||||||
"itemBoxFieldEditable",
|
|
||||||
value,
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
index: 1,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
await ztoolkit.ItemBox.register(
|
|
||||||
"itemBoxFieldNonEditable",
|
|
||||||
"Non-Editable Custom Field",
|
|
||||||
(field, unformatted, includeBaseMapped, item, original) => {
|
|
||||||
return (
|
|
||||||
"[CANNOT EDIT THIS]" + (item.getField("title") as string).slice(0, 10)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
editable: false,
|
|
||||||
index: 2,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
static registerItemPaneSection() {
|
static registerItemPaneSection() {
|
||||||
Zotero.ItemPaneManager.registerSection({
|
Zotero.ItemPaneManager.registerSection({
|
||||||
|
@ -31,16 +31,13 @@ function initZToolkit(_ztoolkit: ReturnType<typeof createZToolkit>) {
|
|||||||
|
|
||||||
import { BasicTool, unregister } from "zotero-plugin-toolkit/dist/basic";
|
import { BasicTool, unregister } from "zotero-plugin-toolkit/dist/basic";
|
||||||
import { UITool } from "zotero-plugin-toolkit/dist/tools/ui";
|
import { UITool } from "zotero-plugin-toolkit/dist/tools/ui";
|
||||||
import { PreferencePaneManager } from "zotero-plugin-toolkit/dist/managers/preferencePane";
|
|
||||||
|
|
||||||
class MyToolkit extends BasicTool {
|
class MyToolkit extends BasicTool {
|
||||||
UI: UITool;
|
UI: UITool;
|
||||||
PreferencePane: PreferencePaneManager;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.UI = new UITool(this);
|
this.UI = new UITool(this);
|
||||||
this.PreferencePane = new PreferencePaneManager(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unregisterAll() {
|
unregisterAll() {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { defineConfig } from "zotero-plugin-scaffold";
|
import { defineConfig } from "zotero-plugin-scaffold";
|
||||||
import pkg from "./package.json";
|
import pkg from "./package.json";
|
||||||
import { copyFileSync } from "fs";
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
source: ["src", "addon"],
|
source: ["src", "addon"],
|
||||||
@ -14,10 +13,6 @@ export default defineConfig({
|
|||||||
xpiDownloadLink:
|
xpiDownloadLink:
|
||||||
"https://github.com/{{owner}}/{{repo}}/releases/download/v{{version}}/{{xpiName}}.xpi",
|
"https://github.com/{{owner}}/{{repo}}/releases/download/v{{version}}/{{xpiName}}.xpi",
|
||||||
|
|
||||||
server: {
|
|
||||||
asProxy: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
build: {
|
build: {
|
||||||
assets: ["addon/**/*.*"],
|
assets: ["addon/**/*.*"],
|
||||||
define: {
|
define: {
|
||||||
@ -39,23 +34,8 @@ export default defineConfig({
|
|||||||
outfile: `build/addon/chrome/content/scripts/${pkg.config.addonRef}.js`,
|
outfile: `build/addon/chrome/content/scripts/${pkg.config.addonRef}.js`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
// If you want to checkout update.json into the repository, uncomment the following lines:
|
|
||||||
// makeUpdateJson: {
|
|
||||||
// hash: false,
|
|
||||||
// },
|
|
||||||
// hooks: {
|
|
||||||
// "build:makeUpdateJSON": (ctx) => {
|
|
||||||
// copyFileSync("build/update.json", "update.json");
|
|
||||||
// copyFileSync("build/update-beta.json", "update-beta.json");
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
// release: {
|
|
||||||
// bumpp: {
|
|
||||||
// execute: "npm run build",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
// If you need to see a more detailed build log, uncomment the following line:
|
// If you need to see a more detailed log, uncomment the following line:
|
||||||
// logLevel: "trace",
|
// logLevel: "trace",
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user