Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikfreedman/testable-apps-script
Developing code for Google Apps Script can be fun, but not being able to test things or use a regular javascript pipeline can be quite annoying, here's a great template to get started!
https://github.com/mikfreedman/testable-apps-script
appscript clasp google-apps-script jest
Last synced: 23 days ago
JSON representation
Developing code for Google Apps Script can be fun, but not being able to test things or use a regular javascript pipeline can be quite annoying, here's a great template to get started!
- Host: GitHub
- URL: https://github.com/mikfreedman/testable-apps-script
- Owner: mikfreedman
- License: mit
- Created: 2020-10-11T00:53:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-29T12:47:54.000Z (over 2 years ago)
- Last Synced: 2024-10-04T13:34:35.598Z (about 1 month ago)
- Topics: appscript, clasp, google-apps-script, jest
- Language: Dockerfile
- Homepage:
- Size: 1.42 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# testable-apps-script
![test](https://github.com/mikfreedman/testable-apps-script/actions/workflows/test.yml/badge.svg)
Developing code for [Google Apps Script](https://developers.google.com/apps-script) can be fun, but not being able to test things or use a regular javascript pipeline can be quite annoying.
This project uses a combination of
* [Webpack](https://webpack.js.org/)
* [Google Clasp](https://github.com/google/clasp)
* [Jest](https://jestjs.io/)To create a workable javascript pipeline for your [V8 Apps Script](https://developers.google.com/apps-script/guides/v8-runtime) project.
## Installation
First, enable the Google Apps Script API: https://script.google.com/home/usersettings
```bash
npm installnpm run clasp login # Setup clasp for pushing code to google
```Create a `.clasp.json` in the root of the project that looks like this
```json
{
"scriptId": "[script id from url]",
"rootDir": "dist/"
}
```
Then, update the [Apps Script Manifest](https://developers.google.com/apps-script/concepts/manifests) located here: [src/appsscript.json](src/appsscript.json)## Development
[src/addon.js](src/addon.js) is the main entrypoint of the application, add your code there!Be sure to add functions that you want Google Apps Script to see to the global variable created at the top of the file.
```javascript
global.newFunction = function() {
console.log("newFunction")
}
```## Testing
```bash
npm test
```## Deploy
``` bash
npm run deploy
```