[proposal] lerna publish with uncommitted changes
See original GitHub issueHi,
I would like to propose a new option for lerna publish command, which would allow us to run lerna publish
with uncommitted changes to the packages.
We need this behaviour for our benchmark test, where we publish all monorepo packages to temporary private registry, then install all these published packages to our skeleton web application. Then we build and run this web application and run simple performance tests to check, that we did not cause some critical performance issues. We run this test in CI and don’t want to push, or create any commits.
Pseudo Script
# Example Repository Structure
# packages/package-a
# packages/package-b
# packages/skeleton (private)
# package.json
# Benchmark Test Script
npm install
npx lerna version prerelease --no-push --no-commit-hooks --no-git-tag-version --allow-branch '*'
npx lerna publish from-package --registry "$PRIVATE_REGISTRY" --no-push --no-git-reset # + some option to ignore uncommitted changes error
# Prepare Skeleton Website
cd $WEB_APPLICATION_PATH
npm install --registry "$PRIVATE_REGISTRY"
npm run build
npm start &
# Run Test Against Our Website
autocannon localhost:3001
I found a solution to use git update-index --assume-unchanged .
, that we could use in CI, but it seems a little bit dangerous and ugly and if somebody tries to run the script locally, it can have some horrible consequences.
I also tried to simply run lerna bootstrap
to link all the packages together, but I ran into another issue with our gulp tasks package, which is used by skeleton web app. Since all the linked dependencies are just symlinks and can use only its own dependencies, it makes a problem when a gulp task requires some project file, which requires some project dependency, which is not a dependency of the gulp task package (I hope its understandable 😄 ). This could be solved by installing all the required packages as dev dependency also to the gulp task package, but it seems rather ugly solution. Also, it is more reliable test, if I try to install actually published packages, since this would also test correctly set dev/production dependencies.
I could not think of any other solution for our use case, but to create custom script to publish all the packages. But it seems unnecessarily complicated solution, because I would expect, that there should be some option for the lerna publish
command, which would allow us to ignore uncommitted changes to the project.
Proposal
lerna publish --skip-check-working-tree
The option --skip-check-working-tree
would skip the check-working-tree and the command would not fail, when there are some uncommitted changes in the project, when trying to publish the packages.
Another solution would be to attach this behaviour to --no-git-reset
, but I am not sure, if I understand this option correctly.
Related Issues
Thank you for your attention and keep up the great work!
Filip
Issue Analytics
- State:
- Created 4 years ago
- Reactions:61
- Comments:7
Top GitHub Comments
This would also be useful for our project where we want to enforce usage of an internal npm registry for package installs via
.npmrc
but we can’t commit.npmrc
becausenpm login
modifies it right before we runlerna publish
. Alternativelylerna publish
could support an--ignore
option.