Add support for CLI parameters to specify the version and message in the add() command - #993
Conversation
🦋 Changeset detectedLatest commit: fa4b14e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit fa4b14e:
|
|
|
||
| - `--open` - opens the created changeset in an external editor | ||
|
|
||
| - `--version` - Creates a changeset with the specified level, |
There was a problem hiding this comment.
Even in this very description here it's also called a "level". I'm not sure if that's the best name for the CLI parameter though - I'd like to have cohesive terminology though. So we should call this with a single name all over the place. I agree that version could be misleading here so I wouldn't chose that
There was a problem hiding this comment.
We call this a "bump type" here:
but a "version type" here:
changesets/packages/types/src/index.ts
Line 10 in 1d3f9f2
|
|
||
| let type: string | undefined; | ||
| if (options?.version) { | ||
| type = options?.version; |
There was a problem hiding this comment.
nit:
| type = options?.version; | |
| type = options.version; |
| let summary: string; | ||
| if (typeof options?.message === 'string') { | ||
| log( | ||
| `--message paramter passed: ${options.message}` |
There was a problem hiding this comment.
| `--message paramter passed: ${options.message}` | |
| `--message argument passed: ${options.message}` |
| log( | ||
| `--message paramter passed: ${options.message}` | ||
| ); | ||
| summary = options.message; |
There was a problem hiding this comment.
we call it summary internally, but also in the prompts - should we then use --message as a CLI parameter? I see how it might be easier for users so I'm not entirely opposed to this but this makes the used terminology ambiguous
There was a problem hiding this comment.
Yeah I chose --message to be consistent with Git, but I'm happy to change it to --summary
The CLI asks this question "Please enter a summary for this change (this will be in the changelogs)." so I'll go with summary
| import { isListablePackage } from "./isListablePackage"; | ||
|
|
||
|
|
||
| function isValidVersion(input?: string): input is 'major' | 'minor' | 'patch' { |
There was a problem hiding this comment.
'none' is also a valid "bump type"
| message, | ||
| } | ||
|
|
||
| if (isValidVersion(version)) { |
There was a problem hiding this comment.
is an invalid argument is given by the user then I'd prefer throwing an error
…the add() command
76b3baa to
6dd5209
Compare
|
Thanks for the feedback on this PR. Made all the requested changes. Also I'm not sure how to actually test this change locally. Can you give me some pointers? |
|
I review these code, nice solution, thx u contribution @TomOConnor95 |
|
@Andarist / @JakeGinnivan Would be great if you could give this PR another review when you have a chance. I think all issues have been addressed, and it'd be great to get this released some time soon |
|
Hi there, was looking for a way to add changesets during a CI pipeline this PR looked liked it would allow to do so is this abandoned? thnks |
Hey, I'm still very keen to get this deployed, but have been waiting for next steps on this PR having fixed the previous requests. @Andarist / @JakeGinnivan please could you give some clarity on the next steps for this? Tom |
|
hi, would really like to see this happen, unless I'm mistaken this would be the only way to generate changesets automatically and have a full automated release cycle I'm guessing this might not be desirable in many cases but in the case of some repetitive workflow with the same kind of changes it would be very helpful is there any other way to not have to go through the manual steps of producing a changeset? thanks |
| @@ -218,12 +222,21 @@ export default async function createChangeset( | |||
| } | |||
| } else { | |||
There was a problem hiding this comment.
It looks like this option would only be available for single package repos. I would personally like an option like this compatible with monorepos, if it would also accept a cli argument such as --package my-package (or even better, some form that allows you to provide a list of packages --package first-package --package second-package). At the very least I think it should be otherwise documented, and possibly an error thrown if you try to use --bump-type within a monorepo.
For my use-case it would be an acceptable limitation that only a single --bump-type be allowed for creating a changeset against multiple packages.
There was a problem hiding this comment.
Yes would be great to have this applicable to monorepos, seeing as that is a core goal of changesets.
For our monorepo the majority of the time you're only allowed to update single packages at a time.
When you update multiple packages they're required to be the same bump version because it will be just be updating configs and the version type ('major', 'minor', 'patch') will be the same for all packages.
makes it possible to specify a single version for all changes
+1 would be great to be able to version the change via the command line so we could automate our releases |
It'd be great to see this merged. I've been waiting on approval from @Andarist/ @JakeGinnivan , having made the requested changes. I have seen the comment from @joekur about multi-package repos: |
|
is your PR here compatible with monorepos, meaning via the cli we can specify the version for all the packages that require version bumps? |
|
It's exactly what I need to automate the creation of a changeset a bit more! IHMO this PR should be split in 2 parts: one with In this case, the PR with |
|
Overlapping changes were implemented by #1121 and we just landed this PR. I know this PR here was first - but the other one caught my attention and it I liked its Nevertheless, thank you for your PR and the contribution. I'm sorry we didn't get to yours earlier. |
|
Glad that this has ended up being sorted out in the end :) thanks!
|

First time contributor
Saw this Issue and thought I'd have a go at solving it: #979
I'm not sure of the steps to actually run this locally to test, but I think it should work ok :)
The --version parameter will only work for single package repos.
The --message parameter should work for monorepos with several packages