Update Commit config to separate add/version and add back skipCi#735
Update Commit config to separate add/version and add back skipCi#735rohit-gohri wants to merge 2 commits intochangesets:mainfrom rohit-gohri:custom-commit-messages
Conversation
🦋 Changeset detectedLatest commit: c6c0533 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 c6c0533:
|
|
Thank you for the PR - I'll try to do a review as soon as possible but I have lots on my plate right now and can't get to everything right away (even though I would really like to 😛 ) |
|
I see how this solution is more robust but I'm not yet sure if we want to allow people to hook into such stuff. I think that for now I would prefer if we'd go with a simpler, builtin, solution. I imagine that we could support this: {
"commit": {
"version": {
"skipCI": true
},
"publish": {
"skipCI": true
}
}
}We'd have to make sure that we use the same default values as the current, implicit, ones. A config like this should only enable auto-commits for the version command: {
"commit": {
"version": true
}
} |
|
@Andarist Have updated the PR to an approach similar to what you described |
|
Thank you for the PR - I will try to review it after the weekend |
| export type Config = { | ||
| changelog: false | readonly [string, any]; | ||
| commit: boolean; | ||
| commit: Commit; |
There was a problem hiding this comment.
This is a breaking change for all packages that receive config from the outside, such as @changesets/apply-release-plan. Previously they could assume that this is a boolean. I think it's not worth a breaking change and perhaps we don't have to normalize this (at least not for the time being) to this object shape.
| packages: [fakePackage] | ||
| }); | ||
|
|
||
| export { getAddLine, getVersionLine }; |
There was a problem hiding this comment.
I think that those don't belong in this package, at least for now - moving those should be reverted, they should stay declared closer to where they are actually called.
| )} when the only valid values are undefined or a boolean` | ||
| )} when the only valid values are undefined or a boolean or an object` | ||
| ); | ||
| } else if (typeof json.commit === "object") { |
There was a problem hiding this comment.
we could also add a check if skipCI is of the correct type within this block
| "fs-extra": "^7.0.1", | ||
| "micromatch": "^4.0.2" | ||
| "micromatch": "^4.0.2", | ||
| "outdent": "^0.5.0" |
There was a problem hiding this comment.
was this added as a runtime dependency? perhaps this should be moved to a dev dep or removed altogether when this suggestion gets applied
|
Actually… while taking a shower i was thinking about this more 😅and i think i’ve figured out an alternative, more robust, design. Gonna post it later today so maybe let’s hold working on this PR until i write it down |
|
My proposal is to accept a string for the commit option that would point to a module responsible for generating those commit messages. We already do a similar thing with "changelog generators": changesets/packages/apply-release-plan/src/index.ts Lines 201 to 223 in c2b9d44 I feel like this would be the most robust option that wouldn't require us to add a somewhat weird shape of the Note that when using the default "commit generator" we'd have to add Open questions:
|
Ha, that was the orignal PR's approach. It's still in this old branch: main...rohit-gohri:old Though I didn't move it into it's own module, I'll open a new PR with the changes.
the changesets for the
I think 2 makes more sense as the input arguments would be completely different. |
Heh, ye - I've reconsidered my previous opinion after getting a better look at what the alternative actually looks like 😅
It doesn't have to be a new module - an additional exntrypoint in the changesets/packages/cli/package.json Line 26 in 0d1debd
Feel free to force-push to this one if you prefer that.
Yep, sounds alright.
Agreed. Such functions could actually be typed somewhat OK with the upcoming dependent parameters but ye, it's probably more straightforward to use separate functions. |
|
Opened #768 based on the discussion here, didn't force push so that we can compare the approaches. Closing this. |
PoC for a possible solution for #688. Made commit option configurable separately for
add/versioncommands. Adds backskipCIoptionOther ways: