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

Lerna 3 bug and workaround #361

Closed
azu opened this issue Aug 26, 2018 · 1 comment · Fixed by #365
Closed

Lerna 3 bug and workaround #361

azu opened this issue Aug 26, 2018 · 1 comment · Fixed by #365
Assignees

Comments

@azu
Copy link
Member

azu commented Aug 26, 2018

lerna 3 has some bug.
We should re-consider to use lerna 3.

Expected Step

$ git checkout -b relase-branch
$ lerna version --conventional-commits
$ lerna publish from-git

Actual Step

$ git checkout -b relase-branch
# lerna require origin branch...
$ git push 
$ lerna version --conventional-commits
# throw error but work...
$ lerna publish from-git --npm-client npm
# --npm-client npm is workaround

lerna version throw error

Simiar with lerna/lerna#1591 lerna/lerna#1581
But, this repository does not have uncommitted changes...

However, lerna version did work. What is this error?

lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove changes before continuing.
lerna info lifecycle iceland-packages@1.0.0~version: Failed to exec version script
lerna ERR! lifecycle error running version in iceland-packages
lerna ERR! lifecycle  Error: iceland-packages@1.0.0 version: `lerna version`
lerna ERR! lifecycle Exit status 1
lerna ERR! lifecycle     at EventEmitter.<anonymous> (/Users/sobear/work/iceland/iceland-packages/node_modules/_npm-lifecycle@2.1.0@npm-lifecycle/index.js:301:16)
lerna ERR! lifecycle     at emitTwo (events.js:126:13)
lerna ERR! lifecycle     at EventEmitter.emit (events.js:214:7)
lerna ERR! lifecycle     at ChildProcess.<anonymous> (/Users/sobear/work/iceland/iceland-packages/node_modules/_npm-lifecycle@2.1.0@npm-lifecycle/lib/spawn.js:55:14)
lerna ERR! lifecycle     at emitTwo (events.js:126:13)
lerna ERR! lifecycle     at ChildProcess.emit (events.js:214:7)
lerna ERR! lifecycle     at maybeClose (internal/child_process.js:925:16)
lerna ERR! lifecycle     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
lerna

lerna publish from-git

lerna publish from-git refer current HEAD.
After We add new a commit current branch, no more work lerna publish from-git expectedly.

 ./node_modules/.bin/lerna publish from-git
lerna notice cli v3.1.4
lerna info versioning independent
lerna notice from-git No tagged release found
lerna success No changed packages to publish

I like @monorepo-utils/publish concept.

Publish packages to npm if needed.

https://github.com/azu/monorepo-utils/tree/master/packages/%40monorepo-utils/publish

lerna publish + yarn does not work

When npmClient is yarn, lerna use yarn.
yarn publish to https://registry.yarnpkg.com/ and throw error.

lerna ERR! yarn publish --ignore-scripts --new-version 1.1.2 --non-interactive almin-react-context-1.1.2.tgz exited 1 in '@almin/react-context'
lerna ERR! yarn publish --ignore-scripts --new-version 1.1.2 --non-interactive almin-react-context-1.1.2.tgz stdout:
yarn publish v1.9.4
[1/4] Bumping version...
info Current version: 1.1.2
[2/4] Logging in...
[3/4] Publishing...
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

lerna ERR! yarn publish --ignore-scripts --new-version 1.1.2 --non-interactive almin-react-context-1.1.2.tgz stderr:
error Couldn't publish package: "https://registry.yarnpkg.com/@almin%2freact-context: You must be logged in to publish packages."

lerna ERR! yarn publish --ignore-scripts --new-version 1.1.2 --non-interactive almin-react-context-1.1.2.tgz exited 1 in '@almin/react-context'

Similar problem?

https://github.com/azu/monorepo-utils/blob/1b5760030fd987f6bf16447aa5e61ff11cad955b/packages/%40monorepo-utils/publish/src/publish.ts#L74-L75

Workaround

lerna publish from-git --npm-client npm
``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant