issue-1060
Allow script ID as argument for list-deployments & list-versions
Add --json option to list-deployments & list-versions
Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for discussion)
- [x]
npm run testsucceeds.
128 passing (581ms)
- [x]
npm run lintsucceeds.
λ npm run lint --fix
> @google/[email protected] lint
> npm run check
> @google/[email protected] check
> biome check src test && npm run compile
Checked 73 files in 24ms. No fixes applied.
> @google/[email protected] compile
> tspc
- [x] Appropriate changes to README are included in PR.
### Versions
List versions of a script.
#### Options
- `--json`: Output list in json format.
#### Examples
- `clasp list-versions`: List all versions for the current project
- `clasp list-versions --json`: List all versions for the current project and output in json
- `clasp list-versions [scriptId]`: List all versions for a script ID
- `clasp list-versions [scriptId] --json`: List all versions for a script ID and output in json
### Deployments
List deployments of a script.
#### Options
- `--json`: Output list in json format.
#### Examples
- `clasp list-deployments`: List all deployments for the current project
- `clasp list-deployments --json`: List all deployments for the current project and output in json
- `clasp list-deployments [scriptId]`: List all deployments for a script ID
- `clasp list-deployments [scriptId] --json`: List all deployments for a script ID and output in json
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Didn't mean to close the issue yet, but wanted the --json flag to be a global option so it's consistent throughout all the commands. If you can resolve the merge conflicts, happy to merge the parameter stuff (but similarly, would rather do this uniformly if there are additional commands that would benefit)
Ah okay I thought you were closing it because you were already implementing it globally as a broader change and this was unnecessary.
Also should be able to do this without modifying anything in src/core. There's a method on the clasp instance to set the script ID if it isn't already set:
const clasp = options.clasp;
if (scriptId) {
clasp.withScriptId(scriptId);
}
Right now that withScriptId function will throw an error if the script is already known, so this would fail if the user is calling it in a dir with a valid clasp project, but we can probably remove/relax that check in src/core/clasp.ts
Also should be able to do this without modifying anything in src/core. There's a method on the clasp instance to set the script ID if it isn't already set:
const clasp = options.clasp; if (scriptId) { clasp.withScriptId(scriptId); }Right now that
withScriptIdfunction will throw an error if the script is already known, so this would fail if the user is calling it in a dir with a valid clasp project, but we can probably remove/relax that check in src/core/clasp.ts
The intention behind that change was to be able to run it with the script id of library dependencies, not limited to the root package. When our users are trying to manage a package that has several libraries they have to navigate to the project and click on each package there.
Do you have any thoughts on that implementation or is it something that is out of scope for the project?
This is what I was thinking to relax the check.
withScriptId(scriptId: string) {
if (this.options.project) {
debug('Project is already configured, overriding scriptId with %s', scriptId);
}
this.options.project = {
scriptId,
};
return this;
}