@@ -31,8 +31,6 @@ const require = createRequire(import.meta.url)
31
31
32
32
const templatesDir = path . resolve ( dirname ( fileURLToPath ( import . meta. url ) ) , '../../functions-templates' )
33
33
34
- const showRustTemplates = process . env . NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true'
35
-
36
34
/**
37
35
* Ensure that there's a sub-directory in `src/functions-templates` named after
38
36
* each `value` property in this list.
@@ -41,7 +39,7 @@ const languages = [
41
39
{ name : 'JavaScript' , value : 'javascript' } ,
42
40
{ name : 'TypeScript' , value : 'typescript' } ,
43
41
{ name : 'Go' , value : 'go' } ,
44
- showRustTemplates && { name : 'Rust' , value : 'rust' } ,
42
+ { name : 'Rust' , value : 'rust' } ,
45
43
]
46
44
47
45
/**
@@ -181,12 +179,10 @@ const pickTemplate = async function ({ language: languageFromFlag }, funcType) {
181
179
if ( language === undefined ) {
182
180
const langs =
183
181
funcType === 'edge'
184
- ? // @ts -expect-error TS(2339) FIXME: Property 'value' does not exist on type 'false | {... Remove this comment to see the full error message
185
- languages . filter ( ( lang ) => lang . value === 'javascript' || lang . value === 'typescript' )
182
+ ? languages . filter ( ( lang ) => lang . value === 'javascript' || lang . value === 'typescript' )
186
183
: languages . filter ( Boolean )
187
184
188
185
const { language : languageFromPrompt } = await inquirer . prompt ( {
189
- // @ts -expect-error
190
186
choices : langs ,
191
187
message : 'Select the language of your function' ,
192
188
name : 'language' ,
@@ -239,7 +235,7 @@ const DEFAULT_PRIORITY = 999
239
235
const selectTypeOfFunc = async ( ) => {
240
236
const functionTypes = [
241
237
{ name : 'Edge function (Deno)' , value : 'edge' } ,
242
- { name : 'Serverless function (Node/Go)' , value : 'serverless' } ,
238
+ { name : 'Serverless function (Node/Go/Rust )' , value : 'serverless' } ,
243
239
]
244
240
245
241
const { functionType } = await inquirer . prompt ( [
@@ -561,6 +557,17 @@ const scaffoldFromTemplate = async function (command, options, argumentName, fun
561
557
562
558
await installAddons ( command , addons , path . resolve ( functionPath ) )
563
559
await handleOnComplete ( { command, onComplete } )
560
+
561
+ log ( )
562
+ log ( chalk . greenBright ( `Function created!` ) )
563
+
564
+ if ( lang == 'rust' ) {
565
+ log (
566
+ chalk . green (
567
+ `Please note that Rust functions require setting the NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE environment variable to 'true' on your site.` ,
568
+ ) ,
569
+ )
570
+ }
564
571
}
565
572
}
566
573
0 commit comments