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"' }
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
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.
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! ๐บ