Currently the file set to upload in the push command is automatically determined. It would be helpful to be able to specify files (both manifest and js) via the command line as well.
The particular use case is to be able to deploy different configurations -- e.g. in test mode I want to use an alternate manifest with execution API enabled, tests bundled, etc. while in prod mode I want to skip all that. This is particularly important for libraries where we don't want to have long-lived deployments, but may want to temporarily deploy as executable or web app for purposes of running tests and don't want to package code that is only used for resting.. Same can be used for add-ons and other things where we'd like to keep test code & configuration somewhat isolated.
My ideal is to have commands in package.json like:
"scripts": {
"push-test": "clasp push --env=test appsscript.test.json test/.js src/.js"
"push-prod": "clasp push --env=prod appscript.prod.json src/**.js",
...
}
Many CLIs allow specifying files via command line -- tsc, babel, jshint, etc.. all allow specifying which files to operate on as args. Typescript is also very close to what is being asked for. By default, it'll pick up all *.ts files as is the current behavior of clasp. But that can be overridden by explicitly providing a list of globs as args.
Do you mean test/prod options like #12?
Sort of, but not just the project ID. Suppose the same technique could be used with renaming .claspignore and manifest files, but it's clunky. Better would be to just take the file patterns as optional arguments. If they're present, push those files. If not, fall back on the current algorithm.
Ideally we'd have both an environment option for auth/project ID and a way to easily change file sets. I'd like my package.json to look something like:
"scripts": {
"push-test": "clasp push --env=test appsscript.test.json test/**.js src/**.js"
"push-prod": "clasp push --env=prod appscript.prod.json src/**.js",
...
}
I don't see a use-case where a 1-line bash script can't solve. I'd rather have the CLI be minimal and use git's features or a bash file instead.
A few reasons:
I'm certainly open to other ways of solving the problem. But in general, it's pretty common that any CLI tools that operate on files allow passing the paths via arguments. That part shouldn't be controversial.
Questions (Can you modify the first comment with the details about this FR to reduce discussion?):
.claspignore works to accommodate explicitly kept files?mv .claspignore-prod .claspignore && mv .appsscript-prod.json .appsscript.json
mv .claspignore-test .claspignore && mv .appsscript-test.json .appsscript.json
Updated the original comment w/examples of other CLIs that behave this way as well as the use case later mentioned in the discussion.
There is similar CLI as clasp. it is gas-manager.
gas-manager has options to specify environment(project ID), credential, etc...
Please see https://github.com/soundTricker/gas-manager#cli
I'll look at PR proposals that use npm's config for environments in package.json.
{
"config": {
"env": {
"prod": ...
"test": ...
}
}
}
I don't see a future where I can support this feature.
Hopefully a wrapper bash script can solve the issue at hand.
Closing this issue, but feel free to comment here as it can be re-opened at a later date.
Most helpful comment
Sort of, but not just the project ID. Suppose the same technique could be used with renaming .claspignore and manifest files, but it's clunky. Better would be to just take the file patterns as optional arguments. If they're present, push those files. If not, fall back on the current algorithm.
Ideally we'd have both an environment option for auth/project ID and a way to easily change file sets. I'd like my package.json to look something like: