windingwind/zotero-plugin-template

meaning of @example?

Closed this issue · 5 comments

What's the exact meaning and purpose of @example in the template? (A guess: it's probably somehow possible to keep the examples for reference, but suppress them when building. Is that correct? If so, how would that work?)

Comment out this line and all functions with the @example decoration will not be actually executed:

return original.apply(this, args);

This is also for having more detailed logs by logging when an example is triggered. People who are not familiar with Zotero can sometimes be confused by how the hooks and lifecycle works.

Ok. Thanks. That makes it clearer.

Comment out this line and all functions with the @example decoration will not be actually executed:

Would it make sense to add this somewhere as a global build option? Or is that actually not necessary since the built plugin will only contain code that is actually used? IIUC, if I don't call the examples via hooks, they will not be included when building the release version.

Technically, if the entrance index.ts does not use a file, then it will not be bundled. You just need to remove the calls and imports from the hooks and the example.ts will be excluded.

Thanks.