Open ShivamJoker opened 1 year ago
Under the hood we're executing an npm install while cdk init
command is being ran. We could potentially allow for pnpm
as well https://github.com/aws/aws-cdk/blob/482dcca501b42d4a1f537274e47193f4db6768ef/packages/aws-cdk/lib/init.ts#L300
I see, I am up for contribution. How do we know which package manager was used to initiate the install?
Does it get passed in command line arguments? process.args
Glad to hear you're interested in contributing! Be sure to check out our contributing guide
I'm not sure there's a way to detect if cdk init
was called with pnpx
. We may have to introduce a cli option for this
@peterwoodworth I found a library which parses the package manager from environment variable - https://github.com/zkochan/packages/tree/main/which-pm-runs
I will integrate this with fallback to npm.
Let me know if this works for you.
@ShivamJoker The templates are currently fixed for npm
. Not that we would never want to support anything else, but they are deliberately basic.
If you are looking at improving your personal/company workflow. May I suggest you have a look at projen which fully support pnpm
The templates are currently fixed for npm
@mrgrain I don't see the downside of improving the developer experience.
Why to force people to use npm
if there are better tools available.
I looked at projen
but it seems like a 3rd party tool which should not be recommended for several reasons like if its updated properly, if it has bugs or security flaws and if we encounter any issues then AWS won't take any responsibility.
The templates are currently fixed for
npm
@mrgrain The Yarn Rulebook advises using $npm_execpath
instead of npm run
in package.json
scripts. That might help?
It's at least portable amongst npm
, pnpm
, and yarn
(all I've tested so far).
Absolutely. I reckon there are 3 places that would need to be adjusted:
package.json
app
in cdk.json
Describe the bug
When I try to init CDK with
pnpm
it starts installing dependencies usingnpm
Expected Behavior
CDK should use
pnpm
to install dependencies instead of just going fornpm
Current Behavior
Installs package using npm
Reproduction Steps
Create a new project with
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.53.0
Framework Version
No response
Node.js Version
16
OS
Arch Linux
Language
Typescript
Language Version
No response
Other information
No response