workers-sdk
workers-sdk copied to clipboard
Support PNPM?
Any chance wrangler2 can support PNPM? It's much faster and has better support for workspaces which pairs nicely with workers using a micro-service approach. Currently, npx wrangler@beta init fails as it defaults to npm.
Yeah, I think we can/should do this. Our yarn integration could also use some work. Thanks for filing this, it had slipped my mind!
I'm interested in working on this. Is this file the only one that needs updating?
One approach could be updating this file to support hasPnpmLock, but I don't think this logic currently supports monorepos as the lock file will often be in a parent directory.
Another approach could be to allow passing in the package manager as a flag and setting npm as the default using yargs. This file could be simplified to do a check to see if the system supports('<package_manager>') and a conditional to use the right package manager object (eg. YarnPackageManager, PnpmPackageManager).
What do you think @threepointone ?
There's some nuance here we might want to revisit. For example, if you use pnpm dlx wrangler init <name> we want to make sure it sets up a pnpm project. (This is separate from looking for the lockfile, which won't exist when the above command is called.). yarn doesn't have a direct executor like npx and pnpm dlx, so maybe that's ok.
I don't think we should add any new flags, we should be able to detect what's executing the command and take a call from there.
Closing this as completed due to #1427, which closed #1202