mahaker / esbuild-gas-plugin

esbuild plugin for Google Apps Script.
MIT License
33 stars 7 forks source link

JSDoc #20

Open shmygol opened 5 months ago

shmygol commented 5 months ago

It would be nice if JSDoc were preserved to enable autocompletion for custom functions.

mahaker commented 5 months ago

Generally agreed! I'm waiting for your PullRequest!

shmygol commented 5 months ago

I don't have much experience with esbuild, but it doesn't seem to be possible: https://github.com/evanw/esbuild/issues/294.

mahaker commented 5 months ago

@shmygol Sorry, I understand what you are requesting. You want this plugin to also output JSDoc for functions implemented by the user. Is this correct?

shmygol commented 5 months ago

Correct. It is essential, because custom formulas in Google Spreadsheets need JSDoc to support auto-completion and user documentation. Instead of using esbuild-gas-plugin I ended up bundling the business logic with an esbulid parameter glabalName: 'Main' and push the bundle together with an unmodified custom index.js containing formulas and hooks required by GAS like this:

/**
 * Hello World
 *
 * @param {string} name Your name
 * @return {string}
 * 
 * @customfunction
 */
function HELLO(name) {
    return Main.hello(name);
}