π‘ [Feature]: Add a new setting that would allow to specify the preferred node package manager
π― 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
- add a new VS Code extension setting to specify the node package manager, default should be npm
- creat an util to easily retrieve this setting
- find all places in the extension in which we use an npm command like
npm installand first retrieve the Node Package Manager from the settings and update the command - update the project upgrade action in which we use the
spfx project upgradeCLI command to now pass also the--packageManageroption 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
@diabhoil I added this issue based on your idea. Would you like to go over it and provide any feed?
@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 ;)
Good idea. I totally forgot about those as well π. I will include that in the issue
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?
merged to dev branch. We should have a pre-release with this shortly