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

Add node types to TS project template #3212

Merged
merged 3 commits into from
Jun 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,31 @@ export class TypeScriptProjectCreateStep extends JavaScriptProjectCreateStep {
protected getPackageJsonDevDeps(context: IProjectWizardContext): { [key: string]: string } {
// NOTE: Types package matches node worker version, not func host version
// See version matrix here: https://www.npmjs.com/package/@azure/functions
let nodeWorkerVersion: string;
let funcTypesVersion: string;
// For the node types package, we'll use the latest LTS version possible
// See version matrix here: https://docs.microsoft.com/azure/azure-functions/functions-versions?pivots=programming-language-javascript#languages
let nodeTypesVersion: string;
switch (context.version) {
case FuncVersion.v4:
nodeWorkerVersion = '3';
funcTypesVersion = '3';
nodeTypesVersion = '16';
break;
case FuncVersion.v3:
nodeWorkerVersion = '2';
funcTypesVersion = '2';
nodeTypesVersion = '14';
break;
case FuncVersion.v2:
nodeWorkerVersion = '1';
funcTypesVersion = '1';
nodeTypesVersion = '10';
Copy link
Contributor

Choose a reason for hiding this comment

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

😨

What's the support state for Functions v2?

Copy link
Member Author

Choose a reason for hiding this comment

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

https://docs.microsoft.com/en-us/azure/azure-functions/language-support-policy#retirement-policy-exceptions

30 September 2022 is the listed date to end support for Node 10 (the latest version for v2). Users will still be able to run Node 10, but this is the main difference:

If you're running functions apps using an unsupported language version, you'll be required to upgrade before receiving support for the function apps.

Aka my team doesn't have to respond to incidents until user's upgrade

break;
default:
throw new Error(localize('typeScriptNoV1', 'TypeScript projects are not supported on Azure Functions v1.'));
}

return {
'@azure/functions': `^${nodeWorkerVersion}.0.0`,
typescript: '^4.0.0'
'@azure/functions': `^${funcTypesVersion}.0.0`,
'@types/node': `${nodeTypesVersion}.x`,
typescript: '^4.0.0',
};
}
}