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 instead of zotero-plugin-template scripts #274

Closed Dominic-DallOsto closed 4 months ago

Dominic-DallOsto commented 4 months ago

Fixes #272

Dominic-DallOsto commented 4 months ago

npm run start seems to also launch firefox debugging tools automatically - maybe we need to update the instructions to remove the part about manually downloading the firefox debug tools?

diegodlh commented 4 months ago

I've just checked this and it seems to be working for me too.

It just doesn't seem to be launching the Firefox debugging tools for me, though. Or maybe I did not understand what you meant by that. I expected Firefox to launch or something. What did you get?

Dominic-DallOsto commented 4 months ago

I run npm run start which launches Zotero.

➜ npm run start

> zotero-cita@0.6.0 start
> zotero-plugin serve

◐ Building version 0.6.0 to build at 2024-07-17 17:25:33 in development mode.     
ℹ Preparing manifest                     
ℹ Preparing locale files                            
ℹ Replacing                                                 
ℹ Running esbuild                          
ℹ Addon prepare OK.                        
✔ Build finished in 5.876 s.               

✔ Server Ready!

First I see this popup (might not happen if you built Zotero from source)

image

Then the "Parent process Browser Toolbox" is also opened

image

diegodlh commented 4 months ago

Regarding the Firefox debugging tools launching automatically...

I'm not getting neither the popup nor the "Parent process Browser Toolbox" window when running npm start. Don't know why.

I do get the window to open automatically (not the popup) if I run Zotero directly with zotero -ZoteroDebugText -jsconsole -debugger.

Anyways, I can get the window to open manually via Tools > Developer > Error Console.

Either way, I don't seem to be able to see the source files and set breakpoints this way; only the console. To do so I still need to use Firefox debugging tools from the browser. Is this your case too?

diegodlh commented 4 months ago

On the other hand, I just made a commit changing the zotero-plugin.config.ts file to create sourcemap files. This should greatly assist in debugging from the browser, as this way the original source files (instead of the output from the build process) are shown. @Dominic-DallOsto does this work for you too?

I wonder whether there is a way to just include these sourcemap files when building in development mode (when I run npm start it says Building ... in development mode). I'm sure there is! I just didn't look into it :)

diegodlh commented 4 months ago

Sorry, one more (very minor!) thing. I still find it a little confusing that we have renamed the static folder as addon. Because I think it doesn't express clearly that there are static assets inside.

Now that where assets are stored seems to be easily configured in zotero-plugin.config.ts... would you mind if I rename this back to static (or assets, if you prefer)?

Dominic-DallOsto commented 4 months ago

Regarding the Firefox debugging tools launching automatically...

I'm not getting neither the popup nor the "Parent process Browser Toolbox" window when running npm start. Don't know why.

I do get the window to open automatically (not the popup) if I run Zotero directly with zotero -ZoteroDebugText -jsconsole -debugger.

Anyways, I can get the window to open manually via Tools > Developer > Error Console.

Either way, I don't seem to be able to see the source files and set breakpoints this way; only the console. To do so I still need to use Firefox debugging tools from the browser. Is this your case too?

Hmmm. Maybe it's a linux vs windows issue.

Do you get the debug tools if you run zotero -jsdebugger? What about if you run zotero --jsdebugger? I think this is a newly added flag that launches the full debugging tools with Zotero. Maybe firefox expects the argument with one dash, but zotero-plugin-scaffold uses 2, which maybe magically works on windows but not linux?

But how you describe with manually opening the error console, or launching the firefox debug tools from the browser to be able to set breakpoints, is what I used to have to do before switching to zotero-plugin-scaffold

Dominic-DallOsto commented 4 months ago

On the other hand, I just made a commit changing the zotero-plugin.config.ts file to create sourcemap files. This should greatly assist in debugging from the browser, as this way the original source files (instead of the output from the build process) are shown. @Dominic-DallOsto does this work for you too?

I wonder whether there is a way to just include these sourcemap files when building in development mode (when I run npm start it says Building ... in development mode). I'm sure there is! I just didn't look into it :)

Apparently the "development" shown there is the Node environment see here.

There's also the option for whether we're building a beta or normal build which changes which update.json gets used.

But yeah I can just enable the sure maps in development mode.

Dominic-DallOsto commented 4 months ago

Sorry, one more (very minor!) thing. I still find it a little confusing that we have renamed the static folder as addon. Because I think it doesn't express clearly that there are static assets inside.

Now that where assets are stored seems to be easily configured in zotero-plugin.config.ts... would you mind if I rename this back to static (or assets, if you prefer)?

I tried this and it doesn't work at the moment - the code at some point still assumes the static files are in a directory called addon. But I'll open an issue to fix that.

See https://github.com/northword/zotero-plugin-scaffold/issues/39

diegodlh commented 4 months ago

Hmmm. Maybe it's a linux vs windows issue.

It seems to be. But I think it may have to be with the xulrunner packaged in the Linux version of Zotero 7 not supporting the -jsdebugger flag for some reason.

Because the flag does work with my downloaded version of Firefox 115.9.1esr.

I tried building Zotero 7 from source code to see whether this would fix it, but it is failing for some other reason.

I posted a message to the zotero-dev mailing list (pending moderation): https://groups.google.com/g/zotero-dev. Let's see what they say: https://groups.google.com/g/zotero-dev/c/h4_UZDml-10

maybe we need to update the instructions to remove the part about manually downloading the firefox debug tools?

Ok to update the instructions, but let's keep the part about manually opening Firefox debug tools for us Linux users :P

github-actions[bot] commented 2 months ago

:rocket: This ticket has been resolved in v1.0.0-beta.0. See Release 1.0.0-beta.0 for release notes.