Skip to content

Guide to Developing Locally

Yash Totale edited this page Mar 5, 2021 · 8 revisions

Guide to Developing Locally

FOLLOW ALL 'Guide to Running Locally' STEPS FIRST!

Set up Clasp

npm run clasp:login
  • This will redirect to a Google Sign in screen. Sign in with [email protected]

  • Click 'Allow' to allow all permissions

  • To confirm that you're logged in:

    npm run clasp:status

Now, you are ready to start developing!

Apps Scripts

Pushing Local Changes

When you edit Apps Scripts (located in the src/Helpers/AppsScript folder), the changes are NOT reflected on the deployed Apps Scripts until you push. When you push, the Node CI GitHub Action automatically pushes your Apps Script changes.

If you wish to to push your local Apps Script changes to production without committing and pushing, run npm run clasp. Make sure you have copied the .clasp.json file from the 'Secret Files' folder in Google Drive. .

Constants

If you need to use constants defined in src/Utils/constants.ts in your Apps Scripts, import the constants as usual but add (code below) somewhere near the start of each file that uses constants. This notifies the pre-clasp script to fill in the constants when pushing and the post-clasp script to remove them after the push is completed. We have to do this because clasp removes all imports when deploying the Apps Scripts.

// START CONSTANTS
// END CONSTANTS

Environment Variables

If you need to use secret variables in the Apps Scripts, use the format process.env.<VARIABLE_NAME>. Make sure that the variable is defined in the .env file. If it is not, follow the 'Creating Environment Variables' wiki for steps on how to create a new environment variable.

Creating Environment Variables

See the 'Creating Environment Variables' wiki for information on the multi-step process of creating environment variables.