cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

Update `spfx project azuredevops pipeline add` and `spfx project github workflow add` to work with any version of SPFx

Open Adam-it opened this issue 8 months ago • 7 comments

🎯 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.

Adam-it avatar May 08 '25 07:05 Adam-it

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?

milanholemans avatar May 08 '25 22:05 milanholemans

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 😜

Adam-it avatar May 08 '25 23:05 Adam-it

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.

milanholemans avatar May 09 '25 19:05 milanholemans

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

Adam-it avatar May 09 '25 19:05 Adam-it

@pnp/cli-for-microsoft-365-maintainers any other feed on this one or can we open it up?

Adam-it avatar Jun 11 '25 10:06 Adam-it

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.

waldekmastykarz avatar Jun 11 '25 11:06 waldekmastykarz

I'll work on that

Adam-it avatar Jun 11 '25 11:06 Adam-it