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 ...
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
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
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.
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
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.