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
feat(lock): add version --sync-workspace-lock
flag to update lock file
#199
Conversation
Codecov Report
@@ Coverage Diff @@
## main #199 +/- ##
==========================================
+ Coverage 93.11% 93.22% +0.11%
==========================================
Files 134 134
Lines 3831 3889 +58
Branches 846 770 -76
==========================================
+ Hits 3567 3625 +58
Misses 264 264
Continue to review full report at Codecov.
|
@StarpTech All your feedback are extremely valuable, learning a lot of things 😉 I might still work on the other PR to update the lock file directly just in case that this option wouldn't work for everyone. I wonder if I should make this the new default, or just leave it as an opt-in flag since it might not work for everyone!? |
--package-lockfile-only
to update lock file--package-lockfile-only
flag to update lock file
I'd enable it by default but with an option to disable it, just in case. We are trying to fix an already broken state. I see no reason to enable it after some manual testing and unit tests. |
Not entirely broken, it is broken for pnpm yes but it's not currently broken for npm users and that is what that other flag is for Since Lerna-Lite requires the user to have a workspace pre-setup, it might be ok to use this new flag and perhaps abandon the code to update the file directly which is always riskier and harder to deal with (you never know when any of the pm client change their lock file structure) |
Make sense. |
- renanme previous flag to `manuallyUpdateRootLockFile` - also make `packageLockfileOnly` to the new enabled default flag - add all unit tests
@StarpTech Note that I decided to not make this new flag the default because I'm afraid of possible breaking change (yarn 1.x classic will actually not work with it). I'm also afraid that some developers might be surprised that running a I still have to test this PR with an actual pnpm project, if you get a change to try yourself then that'd be great too or you can just review the PR and that should be fine too. Thanks a lot @JacobSoderblom if you have a chance to test this new approach, it would be nice too. You will need to enable the new flag in the shell or in |
Awesome, thank you. I'll do and report. One thing. I find the name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good state, but proper tests are missing.
packages/version/src/__tests__/version-conventional-commits.spec.ts
Outdated
Show resolved
Hide resolved
- since the flag `--package-lockfile-only` is no longer the default, we no longer need these lines
Alright, I have addressed all comments identified in the review and I believe to be feature complete
The only thing is that I wanted to also test it with that my pnpm test repo hmm if I run |
I don't use |
I'm not exactly sure what you mean by this line, I mean if you had Lerna-Lite repo cloned, how would you link your pnpm project to use the local lerna-lite code? Typically an |
I misunderstood it. Yes, |
--package-lockfile-only
flag to update lock file--sync-workspace-lock
flag to update lock file
@StarpTech Thanks a lot for the great review and the great flag name suggestion 😉 |
Hi @ghiscoding, will do and thanks for the hard work. |
@ghiscoding I needed it for a lone time, thanks to implement this! But I can't make it works with If you need reproduction, you can clone https://github.com/johnsoncodehk/volar and run |
@johnsoncodehk |
@ghiscoding Of course it's here: #214 (Btw |
quick investigation seems to point to a simple missing |
Description
This flag would run
npm install --package-lock-only
or associated command depending on the package manager client defined innpmClient
(npm, pnpm or yarn). It will try to use the package manager client to update the lock file instead of relying on Lerna-Lite to update the file which requires a lot more code.Motivation and Context
in summary this simplifies a lot the process of updating the lock file and also make it a lot more reliable since we are relying solely on the client to its job with a lot less logic to implement in Lerna-Lite. Relying on the client is also future proof in case the lock file structure ever change.
How Has This Been Tested?
unit tests were added
Types of changes
Checklist: