diegodlh / zotero-cita

Cita: a Wikidata addon for Zotero with citations metadata support
GNU General Public License v3.0
233 stars 12 forks source link

Use zotero-plugin-scaffold? #272

Closed diegodlh closed 4 months ago

diegodlh commented 4 months ago

Hey, @Dominic-DallOsto! So I finally managed to install Node 18 on my computer, so I'm now ready to start trying what you've doing to support Zotero 7 (#257).

First thing I came up with when trying npm start is an error because my Zotero profile doesn't have an extensions folder yet.

Of course this could be fixed by manually adding that folder, but apparently it was already fixed in zotero-plugin-template: https://github.com/windingwind/zotero-plugin-template/pull/113

Which made me think of: how can we benefit from this and future upgrades to zotero-plugin-template?

I'm just beginning to understand how this zotero-plugin-template works, but it looks to me that they may have recently moved (note the zotero-plugin-scaffold requirement in their package.json file) the build, serve, etc scripts to a separate repo made exactly for that: "so that downstream developers can follow along". https://github.com/northword/zotero-plugin-scaffold

Do you think it may make sense to use this zotero-plugin-scaffold package too?

Dominic-DallOsto commented 4 months ago

Ahh yeah that makes sense - I'll look at changing things over to use zotero-plugin-scaffold

Dominic-DallOsto commented 4 months ago

@diegodlh When you have the chance could you test the version in the PR?

diegodlh commented 4 months ago

I tested the version in the PR and it seems to work. Great! Left my comments there.

On the other hand, I assume that by depending on zotero-plugin-scaffold, some dependencies may no longer be required by us directly, right?

For example, I assume replace-in-file may have been added as a development dependency when copying over from zotero-plugin-template, but now that we depend on zotero-plugin-scaffold, which in turn depends on replace-in-file, we may simplify our package.json by removing this dependency on our side. Correct?

I used depcheck to see which other dependencies where no longer necessary, and this is what I got:

Unused dependencies
* querystring-es3
* react-intl
Unused devDependencies
* @typescript-eslint/eslint-plugin
* @typescript-eslint/parser
* chokidar
* compressing
* esbuild
* eslint-config-prettier
* release-it
* replace-in-file
* zotero-types
Missing dependencies
* @eslint/js: ./eslint.config.mjs
* zotero@zotero: ./src/dialogs/citation-importer/index.tsx

However I don't trust this 100%:

First because I'm still beginning to understand how zotero-plugin-scaffold works.

Second because there is dependency release-it, which I expected zotero-plugin-scaffold to depend on (as I assume it is used when running zotero-plugin release; is it?). But it doesn't seem to be a dependency of zotero-plugin-scaffold.

Third because there is zotero@zotero "dependency", which I'm not sure what it is (probably related to Zotero types?) and says to be missing.

What do you think? Do you think it makes sense to remove the dependencies identified by depcheck to simplify our package.json now that we are relying on zotero-plugin-scaffold instead?

northword commented 4 months ago
* @typescript-eslint/eslint-plugin
* @typescript-eslint/parser
* eslint-config-prettier

These dependencies are deprecated by the eslint update and can be safely removed just by referring to package.json in the zotero-plugin-template repository to add new dependencies on eslint.

* chokidar
* compressing
* esbuild
* release-it
* replace-in-file

These dependencies are dependencies of scaffold, and when scaffold is installed, these packages are automatically installed and you do not need to explicitly install them again in your project.

zotero-types

This package is a type file for zotero and is necessary for typescript to work.

northword commented 4 months ago

release-it: scaffold doesn't use release-it now, it uses bumpp to promote version numbers, git commits, git tags, and git pushes. scaffold then implements the ability to create GitHub releases itself.

When running zotero-plugin release locally (non-CI), scaffold will bump version, git commit, git tag, git push. zotero-plugin-template repository has a companion release.yml GitHub Action workflow file, when Action receives tag event, it will execute zotero-plugin release again, at this time (CI environment), scaffold will create github release.

(Sorry for the lack of documentation)

diegodlh commented 4 months ago

Hi, @northword! Thank you so much for your detailed replies and clarifications! No need to apologize for the missing documentation. Instead, thank you for your work in making the great zotero-plugin-template even more usable!