You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow publishing with uncommitted changes in working tree #1581
This might be a feature request, but I'm no longer able to use Lerna in react-cosmos since this check has been introduced.
$ lerna publish --no-git-tag-version --no-push --npm-tag=next
lerna notice cli v3.1.1
lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove changes before continuing.
Here are the publishing steps I follow:
Context: In our monorepo all packages point to src by default
Before publishing, a custom script builds all packages and changes entry points to dist
Publish to npm via Lerna --no-git-tag-version --no-push (with uncommitted changes) --- Except this doesn't work anymore
Run custom script to point packages to src again (clean working tree)
Git commit and push via Lerna version
Is there a way to keep maintaining this flow with the latest API (v3.1.1.)? Maybe an option to skip the clean working tree check?
Feel free to propose alternative workflows that meet this criteria: Code published slightly differs from code pushed to git repo (ie. code published points to dist while code versioned points to src).
PS: I appreciate all the work you've put into making v3 solid!
Is there any blog post or changelog entry where I can read about all the changes from v2 to v3, to understand the migration better?
You should use the root npm script lifecycle prepublishOnly to build all packages and modify the entries, then use a root postpublish to reset them. You can then allow lerna to do the git commit/tag/push, which now always happens before any npm publish is called.
I really should write a blog post on that subject...
It's a little odd that you consider it necessary to modify the main property like this in the first place. Set to "dist" in the first place, it shouldn't need to change if you're properly building all the packages from the root.
It's a little odd that you consider it necessary to modify the main property like this in the first place.
It's a bit different. The main property is set to index.js. But inside index.js there are some require calls that point to either src or dist, transformed by a customed script. Same concept, though.
Set to "dist" in the first place, it shouldn't need to change if you're properly building all the packages from the root.
The reason why paths point to src by default is for Flow types to... flow across packages in development, and for test coverage to be calculated properly from integration tests (locally and in CI).
Not sure what you mean by "properly building all the packages from the root".
By "properly" I meant running Babel or Rollup etc from the root instead of package by package. I could have sworn Flow had the capability of not needing such laborious handholding...
On Aug 19, 2018, at 12:54, Ovidiu Cherecheș ***@***.***> wrote:
It's a little odd that you consider it necessary to modify the main property like this in the first place.
It's a bit different. The main property is set to index.js. But inside index.js there are some require calls that point to either src or dist, transformed by a customed script. Same concept, though.
Set to "dist" in the first place, it shouldn't need to change if you're properly building all the packages from the root.
The reason why paths point to src by default is for Flow types to... flow across packages in development, and for test coverage to be calculated properly from integration tests (locally and in CI).
Not sure what you mean by "properly building all the packages from the root".
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
Also having issues with the new uncommitted changes check. The problem is that we generate a .npmrc file on CI with the relevant credentials (we don't want committed to source control).
Yeah that would also work in my case since the committed version will rarely change. Not ideal for package file though. The approach of modularising everything is great. I’m amazed how many different approaches there are to version, release and publish.
I worked around this constraint by publishing files exactly as they are versioned. The exact solution is specific to Cosmos and can be found here: react-cosmos/react-cosmos#823
If it's not a desireable feature to "allow publishing with uncommitted changes in working tree" then feel free to close this issue. At the moment I'm good.
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.
Activity
evocateur commentedon Aug 19, 2018
You should use the root npm script lifecycle
prepublishOnlyto build all packages and modify the entries, then use a rootpostpublishto reset them. You can then allow lerna to do the git commit/tag/push, which now always happens before anynpm publishis called.I really should write a blog post on that subject...
ovidiuch commentedon Aug 19, 2018
A blog post on this would be great. Do you know any public repo that does something similar to get inspiration from? Thanks!
evocateur commentedon Aug 19, 2018
It's a little odd that you consider it necessary to modify the
mainproperty like this in the first place. Set to "dist" in the first place, it shouldn't need to change if you're properly building all the packages from the root.ovidiuch commentedon Aug 19, 2018
It's a bit different. The
mainproperty is set toindex.js. But insideindex.jsthere are some require calls that point to eithersrcordist, transformed by a customed script. Same concept, though.The reason why paths point to
srcby default is for Flow types to... flow across packages in development, and for test coverage to be calculated properly from integration tests (locally and in CI).Not sure what you mean by "properly building all the packages from the root".
evocateur commentedon Aug 19, 2018
djskinner commentedon Aug 21, 2018
Also having issues with the new uncommitted changes check. The problem is that we generate a .npmrc file on CI with the relevant credentials (we don't want committed to source control).
djskinner commentedon Aug 21, 2018
This little known feature of git did the trick for us:
git update-index --assume-unchanged .npmrcevocateur commentedon Aug 21, 2018
Or just add it to the
.gitignore, like a normal file you want to ignore?djskinner commentedon Aug 21, 2018
Yeah that would also work in my case since the committed version will rarely change. Not ideal for package file though. The approach of modularising everything is great. I’m amazed how many different approaches there are to version, release and publish.
ovidiuch commentedon Aug 28, 2018
I worked around this constraint by publishing files exactly as they are versioned. The exact solution is specific to Cosmos and can be found here: react-cosmos/react-cosmos#823
If it's not a desireable feature to "allow publishing with uncommitted changes in working tree" then feel free to close this issue. At the moment I'm good.
lock commentedon 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.