Update `spfx project azuredevops pipeline add` and `spfx project github workflow add` to work with any version of SPFx
🎯 Aim
Currently the spfx project github workflow add and spfx project azuredevops pipeline add will scaffold an flow for the currently latest SPFx version. What we do is in both commands expose a variable that allow to specify the Node version that should be used in the flow and we set a default value as Node v22 which is currently ok for latest version of SPFx -> example result
What we could do is reuse the compatibility matrix we have in the spfx doctor command, maybe extract it to a separate file, and then based on the SPFx version found in the project pick the correct version of node and set it in the Node version variable.
That way we will allow to create a workflow/pipeline for any version of SPFx.
🤔 Considirations
We need to check as I wonder if GitHub allows running workflows with very old (legacy) versions of Node.js like v8 or v10 🤔. I am sure Azure DevOps does not have problem with it but I think we should recheck this for GitHub.
What should we do if an SPFx version supports multiple versions of Node? We can't just randomly pick one, right? Should we prompt it to the user?
What should we do if an SPFx version supports multiple versions of Node? We can't just randomly pick one, right? Should we prompt it to the user?
good question. I would pick the most recent one so that we will at least try to be most up to date as possible 😜
I think it's not up to us to decide which Node version to use. Maybe the user has a perfect reason not to use the latest Node version because of incompatible dependencies or something like that.
I think it's not up to us to decide which Node version to use. Maybe the user has a perfect reason not to use the latest Node version because of incompatible dependencies or something like that.
yes I understand that, picking the latest version would be only for simplicity. This is just the default value of that variable, the user may update it once the pipeline/workflow is scaffolded. It is not a fixed setting
@pnp/cli-for-microsoft-365-maintainers any other feed on this one or can we open it up?
Agreed with @Adam-it that we should use the latest version possible. We're scaffolding the artifact so folks can always adjust if need be.
I'll work on that