Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,24 @@ import './path/to/module';

This will ensure that Rollup will not remove it from the bundle.

### Linter not allowing unused variables

A [plugin for Google App Script](https://github.com/mato533/rollup-plugin-gas) is included in the Rollup configuration. This automatically creates top-level functions for anything declared on the global object. To avoid unused variables in your code, first use `declare global` to declare the functions you need, and then assign the actual function to your declaration. e.g.:

```ts
declare global {
onOpen(): void;
}

function onOpenFunc(): void {
SpreadsheetApp.getUI().createMenu('Stuff').addToUI();
}

global.onOpen = onOpenFunc;
```

This would result in a top-level `onOpen` function being created in the build results.

## Disclaimer

This is not an officially supported Google product.
177 changes: 164 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"prettier": "^2.8.5",
"rimraf": "^4.4.0",
"rollup": "^3.20.0",
"rollup-plugin-google-apps-script": "^2.0.2",
"ts-jest": "^29.0.5",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
Expand Down
2 changes: 2 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import cleanup from 'rollup-plugin-cleanup';
import license from 'rollup-plugin-license';
import prettier from 'rollup-plugin-prettier';
import rollupPluginGas from 'rollup-plugin-google-apps-script';
import typescript from 'rollup-plugin-typescript2';
import { fileURLToPath } from 'url';

Expand All @@ -36,6 +37,7 @@ export default {
}),
typescript(),
prettier({ parser: 'typescript' }),
rollupPluginGas(),
],
context: 'this',
};