rochejul / npmversion

A command line node module to deal with "bumping" and "npm version"
MIT License
8 stars 2 forks source link

ELIFECYCLE error #7

Closed AndyOGo closed 6 years ago

AndyOGo commented 6 years ago

First thanks for this awesome really needed fix for missing --preid support of npm version.

May I'm wrong here.

Though my eslint and stylelint tests exits both with 0 exist code. And run both combined within an npm test scripts exits with 0 too.

But running them together before npmversion fails by ELIFECYCLE error with exit code of 1:

@axa-ch/patterns-library@2.0.0-beta prebump-major-beta /Users/axawinterthur/dev/axa-ch_style-html-guide test npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @axa-ch/patterns-library@2.0.0-beta prebump-major-beta: test npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @axa-ch/patterns-library@2.0.0-beta prebump-major-beta script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/axawinterthur/.npm/_logs/2017-12-13T16_43_48_507Z-debug.log

It's super wierd, really works alone 🤔

package.json

{
"scripts": {
    "test": "parallelshell 'npm run test-eslint' 'npm run test-stylelint'",
    "test-eslint": "eslint src/",
    "test-stylelint": "stylelint 'src/**/*.scss'",
"bump-major": "test && npmversion --increment major",
    "bump-minor": "test && npmversion --increment minor",
    "bump-patch": "test && npmversion --increment patch",
    "bump-major-beta": "test && npmversion --increment major --preid beta"
}
}
AndyOGo commented 6 years ago

Anyone facing this issue, make sure to use npm run test, not only test.

correct package.json

{
"scripts": {
    "test": "parallelshell 'npm run test-eslint' 'npm run test-stylelint'",
    "test-eslint": "eslint src/",
    "test-stylelint": "stylelint 'src/**/*.scss'",
"bump-major": "npm run test && npmversion --increment major",
    "bump-minor": "npm run test && npmversion --increment minor",
    "bump-patch": "npm run test && npmversion --increment patch",
    "bump-major-beta": "npm run test && npmversion --increment major --preid beta"
}
}
rochejul commented 6 years ago

Hi

Many thanks for your feedback

I will check what can I do, but I think this error is occured before the npmversion tool is called.

However, I will make some tests, because maybe we can face to this issue if we use the pre- and post- npm run scripts around npmversion.

I know that Eslint always return a 0 status code when an error is occured. And for CI, this is quiet annoyed, because the build fails and do not propagate the reports.

So, I often do the following stuff (which works on all platforms):

{
  "scripts": {
    "checkstyle": "node node_modules/eslint/bin/eslint.js --config=.eslintrc --output-file ./target/eslint-reporter-checkstyle.xml --format checkstyle ./app/**/*.js || exit 0"
  }
}

In all cases, I will check what can I do to prevent that.

Many thanks again

Regards

AndyOGo commented 6 years ago

@rochejul Thanks for you quick answer. I already fixed the issue, it was caused by running the test script without npm run before.

It's wrong in your Readme.md at those lines or my npm version (3.10.10) doesn't support that shorter syntax: https://github.com/rochejul/npmversion/blame/master/README.md#L97-L101 https://github.com/rochejul/npmversion/blame/master/README.md#L123-L127 https://github.com/rochejul/npmversion/blame/master/README.md#L163-L167

rochejul commented 6 years ago

Ok I will update the documentation too

Regards