Should Google App Scripts be stored in version control like GitHub

JavascriptGoogle Apps-Script

Javascript Problem Overview


I am confused about the best way to manage shared development of Google App Scripts. The thing is that editing google app scripts is done through an online editor with its own version control in place, but that's not shared with other developers as far as I can tell.

So is the suggested practice that we copy and paste from that editing space into local hard files and then push into the version control system of our choice, and then when we want to test things we copy and paste things back into the online editor? Seems messy and error prone.

I see some people are putting their Google App Scripts in places like Github:

https://github.com/peterneubauer/neo4j-google-apps-script

Would be great it we could push directly from git to deploy on Google App Scripts the same way we do with Heroku. Would really like to be able to run a battery of unit tests against my App Scripts ...

Javascript Solutions


Solution 1 - Javascript

You can star issue 217 and issue 1959 if that is important to you.

Update: Take a look at Advanced Development Process with Apps Script

Solution 2 - Javascript

Here is how I did. I used the command line tool, gdcmdtools, to import and export my GAS project.
And stored the exported project in github.
Example:

  • gdget.py FILE_ID -f json # down files associated with GAS project with id FIELD_ID, you will get PROJECT_NAME.json and the source files.

  • store the files to version control, like: github.

  • gdput.py -t gas PROJECT_NAME.json # update GAS project with project file 'PROJECT_NAME.json'

For more information, check Manage-Google-Apps-Script(GAS)-with-gdcmdtools

Solution 3 - Javascript

I just published an npm module for import/export. It's a simpler version of gdcmdtools linked above. Example usage:

  • gaps init
  • gaps download <fileId> clones complete project in current working directory
  • cd into project folder and run gaps upload to push it back up to Google

Run npm install -g node-google-apps-script or check it out here: https://github.com/danthareja/node-google-apps-script. In the next version I'm planning to add a "sync with github" feature.

Solution 4 - Javascript

You can use Gulp to make it easier.

My source comprises several files and folders, which then get combined into a single file on every save.

Then I copy and paste the build to the script editor to test.

A little easier. I think it would be pretty straightforward to add a function to the Gulp watch task that will automatically update the Google App Script Editor as well

Solution 5 - Javascript

I have not used this, however while reading up on the current state of this request, there was a reference to an Eclipse plugin.

https://developers.google.com/eclipse/docs/apps_script

I'm not sure how I feel about this. I am somewhat enamoured with the fact that the entire development environment is online. Moving part of my build process to my desktop kind of ruins that. Having said that... this may allow for some git/gas integration.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSam JosephView Question on Stackoverflow
Solution 1 - JavascriptJacobvdbView Answer on Stackoverflow
Solution 2 - JavascripttfchenView Answer on Stackoverflow
Solution 3 - JavascriptdtharejaView Answer on Stackoverflow
Solution 4 - JavascriptZach SmithView Answer on Stackoverflow
Solution 5 - JavascriptJefferey CaveView Answer on Stackoverflow