Skip to content

feat: new plugin for managing Node.js versions#3459

Merged
zkochan merged 8 commits into
mainfrom
nvm
May 19, 2021
Merged

feat: new plugin for managing Node.js versions#3459
zkochan merged 8 commits into
mainfrom
nvm

Conversation

@zkochan

@zkochan zkochan commented May 17, 2021

Copy link
Copy Markdown
Member

TODO:

  • add tests
  • select the right Node when running scripts
  • add a new option

pnpm node [args...] will autoinstall Node.js and run it.

If a project has use-node-version set in .npmrc, pnpm will auto-install the specified Node.js version and scripts will run using that version of Node.js

related discussion: #3434

@zkochan

zkochan commented May 17, 2021

Copy link
Copy Markdown
Member Author

I am using the node-version setting in .npmrc to detect which Node.js to run. Not sure if it is OK to reuse this setting. It is currently used by npm for another purpose:

The node version to use when checking a package's engines setting.
ref https://docs.npmjs.com/cli/v7/using-npm/config#node-version

@zkochan

zkochan commented May 18, 2021

Copy link
Copy Markdown
Member Author

As noted by @woss, installing Node.js from the npm registry is not the best solution but it is much faster to implement.

In the future we'll use https://nodejs.org/download/release/index.json to resolve the version of Node.js and download Node.js from the nodejs org, not from the npm registry.

@Aankhen

Aankhen commented May 19, 2021

Copy link
Copy Markdown
Member

This is probably feature creep but it would be nice to support fnm, which runs on Windows as well as everywhere else.

@zkochan

zkochan commented May 19, 2021

Copy link
Copy Markdown
Member Author

@Aankhen do you mean storing the node.js versions in the same place where they are store by fnm?

@Aankhen

Aankhen commented May 19, 2021

Copy link
Copy Markdown
Member

Sorry, between the name and GitHub having trouble rendering some of the files, I misunderstood what this plugin was doing! I’ve looked again and I see it’s unrelated to the script nvm. Apologies! Please carry on. 😳

@zkochan

zkochan commented May 19, 2021

Copy link
Copy Markdown
Member Author

I am going to merge it and release a prerelease for now. If anyone will have comments, I'll make the changes.

cc @pnpm/collaborators

@zkochan zkochan merged commit 84ec82e into main May 19, 2021
@zkochan zkochan deleted the nvm branch May 19, 2021 23:10
@zkochan zkochan added this to the v6.5 milestone May 19, 2021
@woss

woss commented May 20, 2021

Copy link
Copy Markdown
Member

I am going to merge it and release a prerelease for now. If anyone will have comments, I'll make the changes.

cc @pnpm/collaborators

the link for collaborators ^^ is not working, is it because it's private?

@zkochan

zkochan commented May 20, 2021

Copy link
Copy Markdown
Member Author

I published this change as 6.5.0-1

@zkochan

zkochan commented May 20, 2021

Copy link
Copy Markdown
Member Author

the link for collaborators ^^ is not working, is it because it's private?

I don't know why, the collaborators team is set to visible. In any case, we don't do any discussions in private.

@Bessonov

Copy link
Copy Markdown

Does it read engines.node from package.json? I didn't find it in the code. If not, it's planned?

Related feature request for engnes.pnpm: #1383 .

@zkochan

zkochan commented May 23, 2021

Copy link
Copy Markdown
Member Author

No, it does not read that field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants