Standard-version: Custom commit message?

Created on 24 Jul 2018  路  4Comments  路  Source: conventional-changelog/standard-version

Is there a way to override the chore(release): X.Y.Z commit message with a custom message?

I tried creating a .npmrc file in the project containing a new message, but it didn't seem to work :/

message="chore(release): Release v%s :tada:"

Most helpful comment

Looks like it's not documented in the readme (not all CLI flags are), but the CLI supports a custom commit message via:

$ standard-version -m 'chore(release): Release v%s :tada:'

or this:

$ standard-version --message 'chore(release): Release v%s :tada:'

Here's the code ref:
https://github.com/conventional-changelog/standard-version/blob/e5c99f65baf5139244e649d138a6856e494e1a16/command.js#L21-L26

You might be able to define this via a "standard-version" stanza in your package.json as well, but I haven't tested this:

{
  "standard-version": {
    "message": "chore(release): Release v%s :tada:"
  }
}

All 4 comments

Looks like it's not documented in the readme (not all CLI flags are), but the CLI supports a custom commit message via:

$ standard-version -m 'chore(release): Release v%s :tada:'

or this:

$ standard-version --message 'chore(release): Release v%s :tada:'

Here's the code ref:
https://github.com/conventional-changelog/standard-version/blob/e5c99f65baf5139244e649d138a6856e494e1a16/command.js#L21-L26

You might be able to define this via a "standard-version" stanza in your package.json as well, but I haven't tested this:

{
  "standard-version": {
    "message": "chore(release): Release v%s :tada:"
  }
}

ah, yes... I was just a little bit off :)
It did seem odd to me that it wouldn't be supported... didn't occur to me to try to use the config object in package.json...

Probably useless at this point, but a long way 'round to get a similar result was to use a package.json variable with the postcommit hook:

"standard-version": {
  "scripts": {
    "postcommit": "git commit -a --amend -m \"Release v$npm_package_version :tada:\""
  }
}

For anyone that lands here: the environment variable $npm_package_version is set to the old/previous version in package.json and is not updated by standard-version.

thks, i need skip ci in gitlab,

standard-version -m 'chore(release): Release v%s :tada:  [skip ci]'
Was this page helpful?
0 / 5 - 0 ratings