Open brandonkal opened 4 years ago
Interesting! This certainly sounds like a promising improvement.
A first stable version of Yarn 2 has been announced on 24 January 2020:
https://dev.to/arcanis/introducing-yarn-2-4eh1
One of the biggest changes is that Plug'n'Play is enabled by default. You can expect that more and more people will start using it. I just tried it too, only to see it failing and eventually find this GH issue.
Looking at the Migration Guide, I think you do not need to support PnP specially. If Pulumi can detect a yarn
enabled project (yarn.lock
right?), it should launch yarn node
rather than just node
. I assume yarn
will then detect whether the project has PnP enabled or not and calculate the correct NODE_PATH
.
Looking at the NodeJS shim, I see some functionality assuming there is a node_modules
folder.
This will make it a bit harder to get Yarn 2 support in I guess. 😕
For the people who already want to use the other nice features of Yarn 2, but don't be locked out due to PnP, you can still disable it. I found how to disable it in this StackOverflow answer:
.yarnrc.yml
:
nodeLinker: node-modules
Just in case this helps anyone out and I appreciate it's only a stop-gap however yarn add @yarnpkg/pnpify -D
and running pnpify pulumi up
works for me 👍🏻
Would adding an official template here help? When you create a project, you would run...
$ pulumi new typescript-pnp
...to get a project skeleton using Yarn Berry PNP instead of NPM.
Supposing this was possible, WDYT? cc: @ringods and anyone who wants to chime in! :^D
@RobbieMcKinstry Yarn Berry PNP doesn't work at the moment. Some time ago, I tried to submit a PR but failed because there are so many places within the Pulumi CLI which expects a node_modules
folder to be there: #4349
Dang... I was hopeful there might be an expedient solution.
Long term, I want us to decouple the SDKs from ecosystem tools.
For example, Python couples venv
tightly, making it harder to use Poetry. Another example is TS-Node; it would useful to allow a different transpiler, like SWC or ESBuild, to be plugged in instead. We have open issues to track these tools individually, but I want to propose an epic to propose an approach to tackle the unifying theme.
Reporting the same problem for Pulumi project in a pnpm
workspace, strangely it used to work before..
Note to my fellow Pulumi maintainers: anyone coming back to this issue should start reading here. @ringods did a great job summarizing the state of the world and the core challenges faced in implementing pnp support.
On my machine, a kubernetes-typescript install takes: 200 seconds with a standard install 20 seconds with yarn PNP
First-class Yarn PNP support would be appreciated as it would mean much faster project startup time.
Error:
Reproduction
Create a package.json
The tree should now look like this: tree