Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed preversion npm script alters lerna.json #1495

Closed
EvanLovely opened this issue Jul 10, 2018 · 4 comments · Fixed by JetBrains/ring-ui#397
Closed

Failed preversion npm script alters lerna.json #1495

EvanLovely opened this issue Jul 10, 2018 · 4 comments · Fixed by JetBrains/ring-ui#397

Comments

@EvanLovely
Copy link

I have a npm script for preversion that runs linting. After running lerna publish that script failing stops it, but lerna.json still has a bumped version (though no package.json files do).

lerna.json

{
  "lerna": "2.11.0",
  "version": "0.4.0",
  "command": {},
  "npmClient": "yarn",
  "useWorkspaces": true
}

Executable Version
lerna --version 2.11.0
npm --version 6.1.0
yarn --version 1.7
node --version 8.11.1
OS Version
NAME VERSION
macOS Sierra 10.12.3
@evocateur
Copy link
Member

Whoops, yeah, that's definitely happening.

I've fixed it in master, which means lerna 3.x will have the fix as soon as I publish it. I don't have time to update the 2.x line, as it is a dramatically old codebase now, and I'm going to promote v3 out of beta soon.

@christophehurpeau
Copy link

With lerna 3, when preversion fails lerna still publishes:
preversion is called here:

pkg => this.runPackageLifecycle(pkg, "preversion"),

error is catched here :
log.error("lifecycle", `error running ${stage} in ${pkg.name}\n`, err.stack || err);

maybe it should rethrow the error after log it ?

@evocateur
Copy link
Member

@christophehurpeau Whoops, yes, that is definitely an oversight. It should definitely re-throw, perhaps based on an opt-out config option? (lerna run has --no-bail, for example)

@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.