Step committing message
See original GitHub issueI’ve seen that the message in the commit step is not correct. That is the message that is displayed on the terminal when executing a release script that creates the commit. Instead of committing CHANGELOG.md
I’d expect it to be committing package.json package-lock.json CHANGELOG.md
or just committing staged files
.
I’m running standard-version 5.0.1.
$ npm run release
> ...
> standard-version --skip.commit --skip.tag
✔ Running lifecycle script "prerelease"
ℹ - execute command: "if [[ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]]; then exit -1; fi"
✔ bumping version in package.json from 3.4.0 to 3.4.1
✔ bumping version in package-lock.json from 3.4.0 to 3.4.1
✔ outputting changes to CHANGELOG.md
$ npm run release:ok
> ...
> standard-version --sign --commit-all --skip.bump --skip.changelog
✔ Running lifecycle script "precommit"
ℹ - execute command: "git add package.json package-lock.json CHANGELOG.md"
✔ committing CHANGELOG.md
husky > commit-msg (node v11.10.0)
⧗ input: chore(release): 3.4.1
✔ found 0 problems, 0 warnings
(Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )
✔ tagging release v3.4.1
ℹ Run `git push --follow-tags origin master && npm publish` to publish
package.json
"scripts": {
"release": "standard-version --skip.commit --skip.tag",
"release:ok": "standard-version --sign --commit-all --skip.bump --skip.changelog",
"release:publish": "git push --follow-tags"
},
"standard-version": {
"scripts": {
"prerelease": "if [[ \"$(git rev-parse --abbrev-ref HEAD)\" != \"master\" ]]; then exit -1; fi",
"precommit": "git add package.json package-lock.json CHANGELOG.md"
}
},
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Write Better Git Commit Messages – A Step-By-Step ...
This guide outlines steps to elevate your commit messages that you can start implementing today. This article assumes you already understand ...
Read more >How to Write a Git Commit Message, in 7 Steps
Chris' 7 rules of great Git commit messaging ; More detailed explanatory text, if necessary. Wrap it to about 72 ; characters or...
Read more >Git Commit | Atlassian Git Tutorial
The git commit command captures a snapshot of the project's currently staged changes. Committed snapshots can be thought of as “safe” versions of...
Read more >How To Git Commit With Message - devconnected
Learn how you can write Git commit message using the Git commit command with options. Added tips to create useful Git commit message....
Read more >How to Add a Git Commit Message | Shells official site
Step 1: Open the Terminal. And go to the local repository. Then execute the following command. git init. This command helps initialize the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vidavidorra Thanks for the write up and time spent on investigating this issue. I believe you know more than us at this point and a big PR might be hard for us to merge (but PR still welcome!!). @bcoe @hutson any thoughts? @vidavidorra perhaps you could join our slack channel and have a chat with people. Cheers.
I did some researching and it is definitely due to the steps being separated. More specifically, bump not being executed on
release:ok
sobump.getUpdatedConfigs()
returns nothing. Therefore,toAdd
here does not contain the package.json and package-lock.json.@stevemao This issue is also worse than I described in my previous messages since
package.json
andpackage-lock.json
are also not added to git, so it will only commit theCHANGELOG.md
in myrelease:ok
script.An easy fix, in my case at least, could be to
Add an
postcommit
script that willgit add
thepackage.json
andpackage-lock.json
Add the following code just above this line, which will result in the message
✔ committing CHANGELOG.md and all staged files
I think a nicer solution would be to somehow know what files were updated in the bump step so those can be automatically added. Would that be a feasible option? I’m not sure how that would work, maybe by separating the
updateConfigs
function in bump in one function that determines which files need to be updated, that function can then be called from the commit step instead, and another function that actually performs the update?Based on the reactions on above points, I’ll be happy to change the code and create an PR for it.