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(publish): apply publishConfig overrides, closes #404 #415
Conversation
Codecov Report
@@ Coverage Diff @@
## main #415 +/- ##
==========================================
+ Coverage 97.31% 97.32% +0.02%
==========================================
Files 146 147 +1
Lines 4335 4356 +21
Branches 1004 1009 +5
==========================================
+ Hits 4218 4239 +21
Misses 117 117
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@artechventure if you could review this and maybe give it a try on your side, that would be great. It should work as it is, but I'll look into doing a dry-run test tomorrow to make sure it's all good before merging. I'd like to release this quite soon, I got other PRs waiting to be released EDIT I rewrote the code and decided to use the exact same code as pnpm uses (ref pnpm overridePublishConfig.ts), so the override will end up being exactly the same as pnpm. I also finished testing in dry-run mode with temp files, it looks all good. Unless I get any news back, I will probably merge in next couple days. |
await gitCommit(cwd, 'setup'); | ||
}; | ||
|
||
it('overrides npm publish with publishConfig that are valid and leave fields that are not in the whitelist to be untouched and remain in publishConfig', async () => { |
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.
LGTM 👍
minor) 'Property based testing' like fastcheck seems to be very fit in these cases. After merging, can I open another PR and add some more test cases?
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.
I'm not sure what you mean with fastcheck (I don't want to add more deps), but sure you can add more tests once I merge it. I decided to go with the exact same code as pnpm (see here), so that it should do exactly the same as what pnpm would perform
Also, just so you know, I thought that we had to merge object properties when the publishConfig
provides only a partial object in comparison to what is in the root but looking at pnpm implementation it seems to override (reassign) the entire property every time and not try to merge partial object. At the end I want to have the same logic as pnpm and so it makes sense to copy their code implementation
@artechventure this is now available in new v1.13.0 release. Thanks for the contribution & feedback 🤝 |
supersede PR #410, closes #404
Description
It is possible to override some fields in the manifest before the package is published by defining them in
publishConfig
, this PR is both a fix (for #404) and a feature.publishConfig
docsMotivation and Context
resolves issue #404, which was that certain fields defined in
publishConfig
are defined as overrides for the finalpackage.json
to be published. Lerna-Lite should take these in consideration and apply the override when it exists as per pnpmpublishConfig
documentationHow Has This Been Tested?
Added necessary unit tests with all possible variances of overrides
Types of changes
Checklist: