Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SWA create function for node model v4 #3721

Merged
merged 1 commit into from
Jun 22, 2023
Merged

Fix SWA create function for node model v4 #3721

merged 1 commit into from
Jun 22, 2023

Conversation

ejizba
Copy link
Contributor

@ejizba ejizba commented Jun 20, 2023

When picking the template based on a templateId (which is how SWA creates a function here), the functions extension always uses the v3 template even if v4 was selected by the user. I adjusted the filtering in FunctionListStep but it didn't quite work because we were calling FunctionListStep.create before the model prompt. I switched to use the fancy new configureBeforePrompt method which selects the template after the model prompt and worked for me.

Fixes microsoft/vscode-azurestaticwebapps#829

@@ -39,11 +40,11 @@ export function getScriptVerifiedTemplateIds(version: string): (string | RegExp)
// These languages are only supported in v2+ - same functions as JavaScript, with a few minor exceptions that aren't worth distinguishing here
// NOTE: The Python Preview IDs are only temporary.
// NOTE: The Node Programming Model IDs include -4.x as a suffix
const regExps = verifiedTemplateIds.map(t => new RegExp(`^${t}-(JavaScript(-4.x)?|TypeScript(-4.x)?|Python|PowerShell|Custom|Python-Preview|Python-Preview-Append)$`, 'i'));
const regExps = verifiedTemplateIds.map(t => new RegExp(`^${t}-(JavaScript(${nodeV4Suffix})?|TypeScript(${nodeV4Suffix})?|Python|PowerShell|Custom|Python-Preview|Python-Preview-Append)$`, 'i'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template strings in a regular expression? You're braver than me. 😄

@ejizba ejizba merged commit 4dedc34 into main Jun 22, 2023
@ejizba ejizba deleted the ej/swav4 branch June 22, 2023 20:47
@microsoft microsoft locked and limited conversation to collaborators Aug 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node.js v4 Preview typescript function file not created correctly
2 participants