-
Notifications
You must be signed in to change notification settings - Fork 0
Information for Developers
This page is for the owner/developer of the web app.
- Your organisation's domain-specific settings
Application files are stored in this Github repository and hosted in Google Apps Script.
- https://script.google.com/ > Start scripting > Log in
- https://script.google.com/ > New project > Untitled project > type Gsheet Search
- Project Settings (cog icon) > Show "appsscript.json" manifest file in editor
-
Project Settings (cog icon) > Script ID > Copy (this is the same ID as shown in the URL i.e.
https://script.google.com/home/projects/{ID})
Application code may be edited and deployed using the Apps Script project IDE (https://script.google.com/ > My Projects > Gsheet Search > Editor), which is similar to VSCode.
Alternatively, application code can be cloned to your local development environment using clasp. This simplifies some aspects of development and allows the code to be checked into version control (i.e. this repo).
This Medium article about clasp outlines the benefits of this approach.
To configure the CLASP configuration file:
- Open
.clasp.json - Locate the
scriptIdproperty and change its value to your script ID
Then:
npm install
npx clasp loginGet the latest code from the server, to capture changes from any developers not using the Github repo.
npx clasp pullCode execution can be tested by directly calling the serverside functions contained in Main.js.
This is a great way to get developer-friendly error messages, rather than the user-friendly ones provided in-app.
Due to issue #1, this requires jumping over to the online development environment.
npm run editor
# 'Select function to run' from the dropdown:
# doGet - tests the template generation
# Click 'Run'A Husky Git Hook triggers the following tasks whenever code is pushed to Github:
- linting of CSS files
- linting of JavaScript files
- rebuild of the JavaScript documentation (MANual)
Input handling is tested by running Qunit tests on the latest code (aka the TEST BUILD).
Application files are stored in the APPS SCRIPT UNIT TESTS PROJECT, and in the Gsheet Compost Collections app tests repository. See that repository's README for more information.
# EITHER: Update the TEST BUILD then automatically open the test results page
npm run test
# OR: Update the TEST BUILD then manually open/refresh the test results page
npx clasp pushData manipulation can be verified by viewing the MASTER SPREADSHEET. The TEST SPREADSHEET is used during development, to prevent accidental corruption of company data.
Warning: This overwrites all data in the test sheet!
- Open the APPS SCRIPT PROJECT
- Open
Main.gs - Run:
krmSyncRunSheets
This overwrites the test sheet with the latest data (and formatting) from the master sheet.
Visual and interactive testing requires viewing the web app.
# EITHER: Update the TEST BUILD then automatically open the web app
npm run preview
# OR: Update the TEST BUILD then manually open/refresh the web app
npx clasp pushThis updates and opens the latest DEV APP.
This allows changes to be tested without impacting the STABLE APP.
Note: In the online IDE, this Web app URL is accessed under Test deployments.
The initial deployment must be done from the IDE: Deploy > New deployment.
Thereafter, deployments can be managed from the commandline:
# Update the STABLE BUILD
npm run publish --krmmessage="VERSION_DESCRIPTION"This updates and opens the latest STABLE APP.
Then:
- Open the APPS SCRIPT PROJECT
- Open
appsscript.json - Change
dependencies.libraries.versionto the deployed version (integer) - Save changes
The MANual is generated from JSDoc comments in the sourcecode (Local development only).
The good functioning of the app is dependent on the structure of the source spreadsheet being maintained.
Brittleness is mitigated somewhat by referencing strings/labels rather than ranges/locations:
- Column headers - Row and column containing header strings
- Named ranges
- Run range - e.g. Row containing "MT VIC RUN", down to the row containing "MT COOK RUN"
- etc