Standard-version: bug: when used programatically it doesn't analyzes commits and no version bump

Created on 1 Mar 2017  ยท  6Comments  ยท  Source: conventional-changelog/standard-version

when used via node and executed via npm scripts, it doesn't analyses commits and makes no version bump -> erorr is trown:

Error:

$ yarn release
yarn release v0.21.3
$ node scripts/release.js
โœ– skip version bump on first release
โœ” outputting changes to CHANGELOG.md
โœ” committing CHANGELOG.md
Command failed: git commit CHANGELOG.md -m "chore(release): 1.1.1"

{ Error: Command failed: git commit CHANGELOG.md -m "chore(release): 1.1.1"

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'git commit CHANGELOG.md -m "chore(release): 1.1.1"' }

my setup:

git history since last release:

7844389 fix: some temp change in scripts
d3fcb98 chore(release): 1.1.1
457e508 build: handle tag and ammend creation properly

this 7844389 fix: some temp change in scripts -> should bump version to 1.1.2

scripts/release.js

const standardVersion = require('standard-version');
const {isInitialRelease} = require('./lib/utils');

const standardVersionConfig = isInitialRelease() ? {firstRelease: true} : {}

// Options are the same as command line, except camelCase
standardVersion(standardVersionConfig, function(err) {
  if (err) {
    console.log(err)
  }
  // standard-version is done
})

package.json

{
  "scripts": {
     "release": "node scripts/release.js"
  }
}

although everything works when i use it directly from npm scripts:

package.json

{
  "scripts": {
     "release": "standard-version"
  }
}

result:

$ yarn release
yarn release v0.21.3
$ standard-version
โœ” bumping version in package.json from 1.1.1 to 1.1.2
โœ” outputting changes to CHANGELOG.md
โœ” committing package.json and CHANGELOG.md

> husky - npm run -s commitmsg


โœ” tagging release 1.1.2
โ„น Run `git push --follow-tags origin master` to publish
enhancement

Most helpful comment

Hey! sure I will double check. Unfortunately this is in company private repo, so you'll have to wait 'till tomorrow... sorry.

anyway thx for help and super quick responses ! you da man yo! ๐Ÿบ

All 6 comments

Your script is passing {firstRelease: true}, as can be seen from only CHANGELOG.md being included in the commit, even though you have previous releases.

Although I am not sure what the actual error is, since duplicate commit messages shouldn't cause a problem in git, yet it's failing at commit and not tag.. Keeping this open as a bug to investigate that and why the error message is so cryptic.

well it's true only if it's initial release :)

initial release -> when there are no tags at all

const standardVersionConfig = isInitialRelease() ? {firstRelease: true} : {}

so on second run it passes just empty object, although doesn't work as I've described

Are you SURE that it is not sending firstRelease: true, maybe log the options? Because standard-version is acting just as with firstRelease in your logs.. But I will try to carve out time to investigate this. Any reproducing repo/extra info is always appreciated of course ๐Ÿ˜Š

Hey! sure I will double check. Unfortunately this is in company private repo, so you'll have to wait 'till tomorrow... sorry.

anyway thx for help and super quick responses ! you da man yo! ๐Ÿบ

Well, so it appears I'm an idiot ! :D well this is what happens if you work overtime late night. Of course isInitialRelease() was returning opposite... all good now. So either we can close this or keep it open for that error message investigation.

Cheers!

๐ŸŽ‰ I'll keep this to remind me to investigate that message.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gultyaev picture gultyaev  ยท  4Comments

marcoturi picture marcoturi  ยท  5Comments

weaintplastic picture weaintplastic  ยท  5Comments

denouche picture denouche  ยท  6Comments

pdcmoreira picture pdcmoreira  ยท  4Comments