Should Google App Scripts be stored in version control like GitHub [closed]
Asked Answered
N

5

79

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

Nickelsen answered 3/10, 2012 at 16:16 Comment(1)
I am of course aware of the collaboration portion of the GAS docs: developers.google.com/apps-script/collaborating but this seems to be for sharing finished scripts with other developers, rather than collaborating with other developers on the development of a script, which is what something like github supports really well ...Nickelsen
I
49

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

Inexperienced answered 17/11, 2012 at 2:30 Comment(6)
thanks - it's very important to me :-) I've starred and commented on those. I'm not sure why I couldn't those feauture pages - they don't seem to be linked from the google app scripts documentation - I guess pushing people to stackoverflow first is the way to cut the wheat from the chaff ... many thanks for the link!Nickelsen
@SamJoseph things changed a bid since that last post. Now you can work with apps script on eclipse and therefore share more easily on github. Check out this blogpost Total Eclips of the apps scriptInexperienced
cool! That's a great development although ironically I've totally moved away from Google App Scripts since I originally posted due to the difficulty with testing, debugging and managing them. I'm sure that's improved now, but I think it'll be a while before I can check them out again.Nickelsen
The answer now ends with ‘Update: <a href="googledevelopers.blogspot.com.br/2015/12/… a look at Advanced Development Process with Apps Script</a>’; I suggest replacing this with say ‘Update: before requesting the maker fix it, first see the solutions now reported on this page, perhaps most notably https://mcmap.net/q/262523/-should-google-app-scripts-be-stored-in-version-control-like-github-closed’ --including as that solution IS the one presently cited and is even apparently posted by the solution's author ...and it's important to avoid duplicates +give,rather than (accidentally) steal, credit.Kay
Up for an update between the use of the gapps recommended by this 2015 article (github.com/danthareja/node-google-apps-script) and clasp (github.com/google/clasp) ?Unavailing
Old question, but this is currently recommended by google and seems active: github.com/google/claspKugler
C
9

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

Cymric answered 19/12, 2014 at 2:56 Comment(0)
S
6

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.

Scribble answered 31/3, 2015 at 17:15 Comment(1)
Thanks much, including that sounds great! Also, for all to know, (1) this ‘gaps’ has been renamed ‘gapps’ and (2) IMPORTANT: this solution is now officially posted & endorsed & documented by GAS maker Google --at developers.googleblog.com/2015/12/…Kay
F
0

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

Franko answered 21/8, 2015 at 7:17 Comment(0)
F
0

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.

Forehead answered 24/12, 2015 at 13:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.