Skip to content

build(deps): update all dependencies to latest and migrate to zotero-plugin-toolkit v6 - #323

Merged
northword merged 3 commits into
mainfrom
chore/update-deps-to-latest
Nov 7, 2026
Merged

northword merged 3 commits into
mainfrom
chore/update-deps-to-latest

Conversation

@northword

@northword northword commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

closes: #321

Updates every dependency to its latest version and adapts the template to the breaking changes.

Dependency updates

Package From To
zotero-plugin-toolkit ^5.1.0-beta.13 ^6.0.0
zotero-plugin-scaffold ^0.8.2 ^0.9.3
zotero-types ^4.1.0-beta.4 ^4.1.3
@zotero-plugin/eslint-config ^0.6.7 ^0.6.10
eslint ^9.39.2 ^10.14.0
typescript ^5.9.3 ^7.0.2
mocha ^11.7.5 ^12.0.3
@types/node ^24.10.0 ^26.6.6
chai / prettier ^6.2.1 / ^3.7.4 ^6.3.0 / ^3.9.10

npm outdated is clean afterwards.

Breaking changes handled

toolkit v6: ZoteroToolkit no longer exported from the package root

  • src/utils/ztoolkit.ts now uses on-demand module imports (BasicTool, UITool, KeyboardManager, ClipboardHelper, FilePickerHelper, ProgressWindowHelper, VirtualizedTableHelper, DialogHelper, makeHelperTool, unregister) and only instantiates what the template uses. Helpers are bound with makeHelperTool(cls, this) so basicOptions sharing and unregisterAll() behave exactly as before.
  • Bundle size: addontemplate.js 115,727 B → 88,014 B; ReaderTool / ExtraFieldTool / FieldHookManager are no longer bundled (and FieldHookManager's constructor-time Zotero.Item.prototype patching is gone).

toolkit v6: PromptManager removed

  • Zotero has no native command palette API, so PromptExampleFactory and its three registrations are removed, together with the corresponding README sections in all three languages.

toolkit v6: MenuManager removed (deprecated in favor of native API)

  • The three menu examples now use Zotero.MenuManager.registerMenu() with main/library/item and main/menubar/file targets.
  • Zotero.MenuManager only exists in Zotero 8 (zotero-types 4.x), so strict_min_version is bumped to 8.0 in addon/manifest.json.
  • Menu strings moved from addon.ftl to mainWindow.ftl (en-US + zh-CN), resolved by the already-loaded main-window FTL bundle instead of injecting addon.ftl into the main window again.

TypeScript 7 (native compiler) vs. type-aware ESLint

  • TS 7 ships no compiler JS API, so typescript-eslint fails with Cannot read properties of undefined (reading 'Intrinsic').
  • typescript stays at ^7.0.2 for tsc, while package.json overrides pins typescript@6.0.3 for the typescript-eslint subtree. npm run build uses 7.x, npm run lint:check uses the pinned 6.x copy.

npm 12 blocks git dependencies

  • zotero-types depends on git-hosted packages (epubjs, pdfjs-dist), so npm ci fails with EALLOWGIT on npm >= 12. Added .npmrc with allow-git=all.

prettier 3.9 formatting

  • prettier --check failed on doc/README-frFR.md after the upgrade (blockquote indentation); reformatted.

Verification

  • npm ci (clean install, npm 12.0.2 / Node 26)
  • npm run build (scaffold build + tsc --noEmit)
  • npm run lint:check (prettier + eslint 10)

npm run test was not run locally since it launches Zotero.

- zotero-plugin-toolkit 5.1.0-beta.13 -> 6.0.0
- zotero-plugin-scaffold 0.8.2 -> 0.9.3
- zotero-types 4.1.0-beta.4 -> 4.1.3
- eslint 9 -> 10, @zotero-plugin/eslint-config 0.6.10
- typescript 5.9 -> 7.0.2
- mocha 11 -> 12, chai 6.3, prettier 3.9, @types/node 26

typescript-eslint does not support the TypeScript 7 native compiler
yet (it no longer exposes the compiler API), so pin typescript@6.0.3
for its dependency subtree via package.json overrides while tsc keeps
using 7.x.

npm 12 blocks git dependencies by default and zotero-types depends on
git-hosted packages (epubjs, pdfjs-dist), so set allow-git=all in
.npmrc.
toolkit v6 removed the deprecated global modules:

- ZoteroToolkit is no longer exported from the package root, use
  on-demand module imports instead and only bundle what the plugin uses.
- PromptManager was removed. Zotero has no native command palette
  equivalent, so drop PromptExampleFactory and its registrations.
- MenuManager was removed in favor of the native Zotero.MenuManager API,
  which only exists in Zotero 8. Rewrite the three menu examples with
  Zotero.MenuManager.registerMenu() and bump strict_min_version to 8.0.
- Move the menu l10n messages from addon.ftl to mainWindow.ftl, since
  they are resolved from the main window's FTL bundle.
- remove the PromptExamples section from all READMEs
- note that registerRightClickMenuItem uses the native Zotero.MenuManager
- reformat doc/README-frFR.md for prettier 3.9 (blockquote indentation)
@northword
northword force-pushed the chore/update-deps-to-latest branch from 2877897 to ed85840 Compare November 7, 2026 16:42
@northword
northword merged commit 274af95 into main Nov 7, 2026
3 checks passed
@northword
northword deleted the chore/update-deps-to-latest branch November 7, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move to zotero-plugin-toolkit 6 so new plugins don't ship the zotero:// handlers

1 participant