File tree 2 files changed +10
-1
lines changed
__tests__/templating/__snapshots__
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ exports[`writeDefaultConfigFile default file should match snapshot 1`] = `
36
36
// \\"production\\": false /* Promote build to the production environment (no domain suffix). Overrides environment flag */,
37
37
// \\"properties\\": null /* Specify the output properties you want to see. Works best on single types */,
38
38
// \\"region\\": null /* Twilio API Region */,
39
- // \\"runtime\\": null /* The version of Node.js to deploy the build to. (node12 or node14) */,
39
+ \\" runtime\\ " : \\ " node12 \\ " /* The version of Node.js to deploy the build to. (node12 or node14) */ ,
40
40
// \\"serviceName\\": null /* Overrides the name of the Serverless project. Default: the name field in your package.json */,
41
41
// \\"serviceSid\\": null /* SID of the Twilio Serverless Service to deploy to */,
42
42
// \\"sourceEnvironment\\": null /* SID or suffix of an existing environment you want to deploy from. */,
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import { getDebugFunction } from '../utils/logger';
9
9
10
10
const debug = getDebugFunction ( 'twilio-run:templating:defaultConfig' ) ;
11
11
12
+ const DEFAULT_RUNTIME = 'node12' ;
13
+
12
14
function renderDefault ( config : Options ) : string {
13
15
if ( config . type === 'boolean' ) {
14
16
if ( typeof config . default === 'boolean' ) {
@@ -26,6 +28,13 @@ function renderDefault(config: Options): string {
26
28
}
27
29
28
30
function templateFlagAsConfig ( [ flag , config ] : [ string , Options ] ) {
31
+ if ( flag === 'runtime' && typeof config . default !== 'string' ) {
32
+ // special case for runtime with a hard coded default for a better Node.js transition
33
+ return `\t"${ camelCase ( flag ) } ": "${ DEFAULT_RUNTIME } " \t/* ${
34
+ config . describe
35
+ } */,`;
36
+ }
37
+
29
38
return `\t// "${ camelCase ( flag ) } ": ${ renderDefault ( config ) } \t/* ${
30
39
config . describe
31
40
} */,`;
You can’t perform that action at this time.
0 commit comments