Clasp: Allow pushing to multiple script id's

Created on 10 Oct 2018  路  6Comments  路  Source: google/clasp

Use case

When managing container-bound scripts across multiple containers, it would be helpful if you are able to push to all of them in one go. This way you can have one project source and trust that all the documents will work the same.

Potential Behavior

Given the following clasp.json

{
  "scriptId": "<root-id>",
  "mirrorIds": ["<other-script-id>", "<another-script-id>"]
}

clasp push would push the files to "<other-script-id>" and "<another-script-id>" projects as well as "<root-id>" project.

I've got a rough version of this working, but I figured the exact details would need some discussion and tweaking before submitting a pull request, assuming this is a feature you'd want to support.

Most helpful comment

Adding clasp settings in #350 makes this easy to do now, so closing. Thanks!

All 6 comments

I think a better solution would be a bash script push.sh which contains:

clasp setting scriptId <id>
clasp push
clasp setting scriptId <id2>
clasp push

That way, it more customizable, and would solve other problems with creating setting values.
LMK if that works for your use-case.

@arichardsmith

My question is around the workflow and it doesn't touch the code. Did you tried a trigger injection instead code multi copies? You can bind up to 25 sheets for one project.

@oshliaer

My use case needs to use getUi, which as far as I know is only available to container-bound scripts. If there is a way to get around this then I wouldn't need to mirror to multiple scripts, which would be great!

@oshliaer
I did not realise that any function triggered by a spreadsheet runs as if it is container bound. That's really helpful!

@grant
Seems like there is a workaround, but if you would still like to add a clasp settings feature I'm happy to finish off working on it.

Adding clasp settings in #350 makes this easy to do now, so closing. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RomainVialard picture RomainVialard  路  5Comments

Haris-Jamil picture Haris-Jamil  路  6Comments

OleksandrRakovets picture OleksandrRakovets  路  3Comments

PopGoesTheWza picture PopGoesTheWza  路  4Comments

dskeithbuck picture dskeithbuck  路  5Comments