vscode-viva icon indicating copy to clipboard operation
vscode-viva copied to clipboard

πŸ’‘ [Feature]: Add a new setting that would allow to specify the preferred node package manager

Open Adam-it opened this issue 6 months ago β€’ 4 comments

🎯 Aim of the feature

The aim is to add a new setting to SPFx Toolkit to allow to specify the preferred node package manager that will be used. It should be able to specify between npm (which should be the default option) and pnpm or yarn

Then, in all places SPFx Toolkit runs any npm script, we should first check the new setting and use either npm or pnpm or yarn. SPFx Toolkit uses npm to install the global dependencies like yo or gulp-cli and also to run npm install when new project is scaffolded from the create new project form or based on a sample. Also, the upgrade action uses CLI command spfx project upgrade command, which also supports passing the node package manager by using the --packageManager option, which we should now also use and fill based on this setting

Plan

  1. add a new VS Code extension setting to specify the node package manager, default should be npm
  2. creat an util to easily retrieve this setting
  3. find all places in the extension in which we use an npm command like npm install and first retrieve the Node Package Manager from the settings and update the command
  4. update the project upgrade action in which we use the spfx project upgrade CLI command to now pass also the --packageManager option and pass the node package manager from the settings

Additional context for an Agent

  • create your feature branch with the implementation based on dev branch. This is a must
  • when opening a PR you MUST target dev branch
  • do not update npm-shrinkwrap file

Adam-it avatar Jul 03 '25 13:07 Adam-it

@diabhoil I added this issue based on your idea. Would you like to go over it and provide any feed?

Adam-it avatar Jul 03 '25 13:07 Adam-it

@Adam-it Thank you. Looks very good. Unfortunately I haven't had time to look at the code yet.

Maybe you could also add yarn as a package manager? The spfx project upgrade command does it support to. So maybe it can even get further and create the SPFx upgrade help file with pnpm or yarn instead of npm?

There are certainly more use cases. I certainly haven't used all the functions of the extension yet ;)

diabhoil avatar Jul 07 '25 17:07 diabhoil

Good idea. I totally forgot about those as well πŸ‘. I will include that in the issue

Adam-it avatar Jul 07 '25 17:07 Adam-it

I think the spec is solid enough. If there is no more input, let's open it up and get this shipped πŸ‘πŸš€

@diabhoil, it has already been some time, but did you consider contributing to SPFx Toolkit and maybe starting with this issue?

Adam-it avatar Oct 17 '25 20:10 Adam-it

merged to dev branch. We should have a pre-release with this shortly

Adam-it avatar Dec 11 '25 22:12 Adam-it