Skip to content

A Rollup project configrured for use Google Apps Script development using Clasp. It allows you to develop for Google Apps Script while modern JS practices and then to build to a single `code.gs` file that is ready for deployment to your Google Apps Script project.

License

Notifications You must be signed in to change notification settings

NathanielBrewer/gas-rollup-build

Repository files navigation

Google Apps Script Rollup Build

Develop modular JavaScript with import and export statements, NPM packages, and dev and prod targets. Build to a code.gs file that is executable in your Google Apps Script project.

Installation and commands

  1. Clone the repository

    git clone https://github.com/NathanielBrewer/gas-rollup-build.git
    cd gas-rollup-build
  2. Install dependencies

    npm install
  3. Configure Google Apps Script

    • Navigate to your Google Apps Script project and open the Project Settings
    • Copy the Script ID and paste it into either the devScriptId, prodScriptId, or the scriptId variable in the .clasp.json file located at src/.clasp.json
    • Adjust the appscript.json as needed. Documentation available here
  4. Develop

    • The entry file is src/code.js. This gets built to build/<target>/code.gs, which is a runnable Google Apps Script file.
    • After making changes and any files in the src/ directory, a build:<target> command must be run before those changes will be exectuable by Google Apps Script.
    • While developing, make your changes and then use reload:<target> to run both build:<target> and push:<target> commands.
  5. Build

    The build step is required to convert the files into a single Google Script file that can then be pushed and deployed to your Apps Script project.

    Command:

    npm run build:<target>

    where the "target" is either prod or dev

  6. Push

    Invoke clasp push for either the prod or dev script ID

    npm run push:<target>
  7. Deploy

    Invoke clasp deploy for either the prod or dev script ID

    npm run deploy:<target>
  8. Reload

    For faster development, build and push in one command

    npm run reload:<target>

    where the "target" is either prod or dev

About

A Rollup project configrured for use Google Apps Script development using Clasp. It allows you to develop for Google Apps Script while modern JS practices and then to build to a single `code.gs` file that is ready for deployment to your Google Apps Script project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published