question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Step committing message

See original GitHub issue

I’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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stevemaocommented, Mar 29, 2019

@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.

1reaction
vidavidorracommented, Mar 28, 2019

I did some researching and it is definitely due to the steps being separated. More specifically, bump not being executed on release:ok so bump.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 and package-lock.json are also not added to git, so it will only commit the CHANGELOG.md in my release:ok script.

An easy fix, in my case at least, could be to

  1. Add an postcommit script that will git add the package.json and package-lock.json

  2. Add the following code just above this line, which will result in the message ✔ committing CHANGELOG.md and all staged files

      if (args.commitAll) {
        msg += ' and %s'
        paths.push('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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found