Commit Graph

4 Commits

Author SHA1 Message Date
Julien P 98b90f1902
Add packagemanager prompt to pulumi new for nodejs ()
https://github.com/pulumi/pulumi/pull/16346 introduced the capability to
query the language runtime for additional prompts. We use this to let
the user pick a package manager among npm, yarn and pnpm during `pulumi
new` when using the nodejs runtime.

When there is no explicitly configured package manager, we re-use the
previous behaviour for determining the package manager (check
`PULUMI_PREFER_YARN` env variable, look for lock files).

Defaults to `npm` when running `new` in non-interactive mode.
2024-06-21 11:35:06 +00:00
Julien P 2a2d247755
Use pnpm as package manager if we find a pnpm-lock.yaml file ()
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

Initial support pnpm. Note that this does not support pnpm workspaces
yet.

This also does not handle passing the package manager through from
`pulumi new`. Once a user manually runs pnpm, creating a pnpm-lock.yaml,
we'll detect that and pnpm.

Fixes https://github.com/pulumi/pulumi/issues/15455

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-02-21 13:41:21 +00:00
Robbie McKinstry ff0e13c5e0
Add unit test for npm installation. 2023-05-26 11:43:22 -04:00
Robbie McKinstry 0251902d50
Abstract package manager behavior behind interface.
This PR moves the logic of `Install` and `Pack` behind an interface
for each of the supported package managers. We now dynamically dispatch
to an NPM implementation for NPM installation WLOG yarn.
2023-05-24 12:55:02 -04:00