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

If "version" script is defined in package.json, should show meaningful error #1844

Closed
azu opened this Issue Jan 2, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@azu
Copy link

azu commented Jan 2, 2019

Expected Behavior

If "version" script is defined in package.json, lerna version {version} show meaninful error.

Current Behavior

lerna version {version} show unuseful message.

"EUNCOMMIT Working tree has uncommitted changes, please commit or remove changes before continuing"

> monorepo-sandbox@1.0.0 version /Users/azu/.ghq/github.com/azu/monorepo-sandbox
> lerna version --conventional-commits

lerna notice cli v3.8.1
lerna info versioning independent
lerna info Looking for changed packages since initial commit.
lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove changes before continuing.
lerna info lifecycle monorepo-sandbox@1.0.0~version: Failed to exec version script
lerna ERR! lifecycle "version" errored in "monorepo-sandbox", exiting 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Possible Solution

  • Lerna: show meaningful error message for this case
  • User: Remove "version" life-cycle script or rename "version" script.

Related:

Steps to Reproduce (for bugs)

  1. Define "script.version" in pacakge.json
  2. lerna version patch

package.json:

  "scripts": {
    "bootstrap": "lerna bootstrap",
    "version": "lerna version --conventional-commits",
    "version:patch": "lerna version patch --conventional-commits",
    "version:minor": "lerna version minor --conventional-commits",
    "version:major": "lerna version minor --conventional-commits",
    "publish": "lerna publish from-package"
  },
lerna.json

{
  "packages": [
    "packages/*"
  ],
  "version": "independent",
  "npmClient": "yarn",
  "useWorkspaces": true
}

lerna-debug.log

lerna notice cli v3.8.1
lerna info versioning independent
lerna info Looking for changed packages since initial commit.
lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove changes before continuing.
lerna info lifecycle monorepo-sandbox@1.0.0~version: Failed to exec version script
lerna ERR! lifecycle "version" errored in "monorepo-sandbox", exiting 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Context

I think that some user define "version" script.
I have seen the error and search it in lerna repository.
I found multiple similar issues.

Your Environment

Executable Version
lerna --version 3.8.1
npm --version 6.5.0
yarn --version 1.12.3
node --version v10.13.0
OS Version
NAME VERSION
macOS 10.14.2
@evocateur

This comment has been minimized.

Copy link
Member

evocateur commented Jan 2, 2019

Sure, I suppose I can't force everyone to use reasonable script names. The "publish" and "version" lifecycles are also called by npm publish and npm version, which are too close to npm run publish and npm run version for comfort. I personally recommend naming the script "release", npm run release is unambiguous and easily pre- and post-hooked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment