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: pnpm workspaces support #3284
Conversation
Great work @fahslaj! Excited about this |
look forward |
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.
Please see slack conversation for final testing plan before we land this
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.
Let's do this!
Could you clarify the reasoning here? how is lerna using typescript? is it using it via a third party? |
@AviVahl typescript is used at runtime for workspace package-graph analysis |
Thanks. I've checked the code and this is only done by nx. Installing nx, and now typescript, for everyone who uses lerna is beyond me. The direction this project has taken is quite worrisome from my perspective. |
Hi @AviVahl @PeterShershov @YardenPorat 👋 We can appreciate the instinctive concern, however please allow me to break down the full context here. Hopefully it will set your minds at ease. Adding a dependency on Nx in order to use it within the implementation details of Lerna increases the size of the node_modules but only by a very small amount. An empty Lerna workspace without Nx is about 72MB, and an empty Lerna workspace with Nx is 75MB. It’s about a 5% increase for a completely empty workspace. For non-empty workspaces with real app and libs, the increase should be less than 1%. This is very small, and even this very small increase is a temporary one. By adding Nx, we will now be in a position to remove some older packages, so in the longer run the result will be smaller node_modules for all workspaces. Lerna provides many capabilities: running tasks, bootstrapping, publishing, generating packages, importing existing packages. Unless you use all of those things, some percentage of the 72MB that Lerna had is already something you didn’t need or use. The small, temporary increase you see should therefore not be significant. So that's the small, and temporary, trade-off covered, but what exactly does using Nx within some of lerna's implementation details enable for us and all lerna users? Well, it's very, very significant:
In summary then, leveraging Nx inside of lerna's implementation details should allow us to improve a lot of core capabilities of Lerna: code generation, importing, publishing, and running tasks - and also implement hotly requested, but otherwise complex to achieve, feature requests. All without requiring users to refactor their existing workspaces, or change their existing commands! I hope that is all clear, if you have any questions about the above, or specific concerns about a particular package, or something is causing issues for you, please let us know and we will look into it for you. Many thanks for being a part of the lerna community and for sharing your thoughts 🙏 |
@fahslaj
ERR_PNPM_OUTDATED_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with __packages__/ep-basic/package.json
Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"
|
Hi @lefreet I commented on the discussion here: pnpm/pnpm#4241 (comment) Please don't comment on old closed issues/PRs, it's not a scalable way to get support as it will likely be missed and/or be combined with stuff which isn't actually applicable to your specific concerns. Please take a look at what I have written on the discussion and if you are still having trouble please open a new issue with as much information as possible about your specific situation. |
Description
Add support for pnpm workspaces:
pnpm-workspace.yaml
whennpmClient
ispnpm
(and enforce"useWorkspaces": true
inlerna.json
)lerna version
lerna bootstrap
,lerna link
, andlerna add
when using pnpm and direct the user to the pnpm docs. Instead dependencies should be managed and installed directly usingpnpm
.pnpm
withoutuseWorkspaces: true
lerna version
Adds typescript as an explicit dependency of Lerna to satisfy strict peer dependency checking.
Motivation and Context
#1818
#3195
This change allows users to use pnpm and lerna easily in the same project.
How Has This Been Tested?
I tested changes manually with multiple test workspaces. Commands I tested manually include: version, publish, ls, run, bootstrap, link. I also added comprehensive unit tests around the new functionality and a couple end to end tests for versioning and publishing.
Types of changes
Checklist: