Skip to content

Commit 2488064

Browse files
committed
feat(deploy): add runtime parameter to deploy
1 parent 4bb7b98 commit 2488064

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"author": "Dominik Kundel <[email protected]>",
3939
"license": "MIT",
4040
"dependencies": {
41-
"@twilio-labs/serverless-api": "^4.0.1",
41+
"@twilio-labs/serverless-api": "^4.1.0",
4242
"@twilio-labs/serverless-runtime-types": "^1.1.7",
4343
"@types/express": "^4.17.0",
4444
"@types/inquirer": "^6.0.3",

src/commands/deploy.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function handleError(
4545
const fullCommand = getFullCommand(flags);
4646
const messageBody = stripIndent`
4747
Here are a few ways to solve this problem:
48-
48+
4949
- Rename your project in the package.json "name" property
5050
- Pass an explicit name to your deployment
5151
> ${constructCommandName(fullCommand, 'deploy', [
@@ -59,7 +59,7 @@ function handleError(
5959
'--override-existing-project',
6060
])}
6161
- Run deployment in force mode
62-
> ${constructCommandName(fullCommand, 'deploy', ['--force'])}
62+
> ${constructCommandName(fullCommand, 'deploy', ['--force'])}
6363
`;
6464
logger.error(messageBody, err.message);
6565
} else if (err.name === 'TwilioApiError') {
@@ -203,6 +203,11 @@ export const cliInfo: CliInfo = {
203203
type: 'string',
204204
describe: 'Specific folder name to be used for static functions',
205205
},
206+
runtime: {
207+
type: 'string',
208+
describe:
209+
'The version of Node.js to deploy the build to. (node10 or node12)',
210+
},
206211
},
207212
};
208213

src/config/deploy.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type DeployCliFlags = Arguments<
3737
assets: boolean;
3838
assetsFolder?: string;
3939
functionsFolder?: string;
40+
runtime?: string;
4041
}
4142
>;
4243

@@ -100,8 +101,7 @@ export async function getConfigFromFlags(
100101
);
101102
}
102103

103-
const region = flags.region;
104-
const edge = flags.edge;
104+
const { region, edge, runtime } = flags;
105105

106106
return {
107107
cwd,
@@ -121,5 +121,6 @@ export async function getConfigFromFlags(
121121
noFunctions: !flags.functions,
122122
region,
123123
edge,
124+
runtime,
124125
};
125126
}

src/printers/deploy.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function plainPrintDeployedResources(
6060
environmentSuffix: config.functionsEnv,
6161
environmentSid: result.environmentSid,
6262
buildSid: result.buildSid,
63+
runtime: result.runtime,
6364
viewLiveLogs: getTwilioConsoleDeploymentUrl(
6465
result.serviceSid,
6566
result.environmentSid
@@ -92,6 +93,7 @@ function prettyPrintConfigInfo(config: DeployLocalProjectConfig) {
9293
{bold.cyan Root Directory}\t${config.cwd}
9394
{bold.cyan Dependencies}\t${dependencyString}
9495
{bold.cyan Env Variables}\t${Object.keys(config.env).join(', ')}
96+
{bold.cyan Runtime}\t\t${config.runtime}
9597
`
9698
);
9799
}
@@ -108,6 +110,7 @@ function plainPrintConfigInfo(config: DeployLocalProjectConfig) {
108110
rootDirectory: config.cwd,
109111
dependencies: dependencyString,
110112
environmentVariables: Object.keys(config.env).join(','),
113+
runtime: config.runtime,
111114
};
112115
writeOutput(`configInfo\n${printObjectWithoutHeaders(printObj)}\n`);
113116
}
@@ -131,9 +134,11 @@ function prettyPrintDeployedResources(
131134
{bold.cyan Service:}
132135
${config.serviceName} {dim (${result.serviceSid})}
133136
{bold.cyan Environment:}
134-
${config.functionsEnv} {dim (${result.environmentSid})}
137+
${config.functionsEnv} {dim (${result.environmentSid})}
135138
{bold.cyan Build SID:}
136139
${result.buildSid}
140+
{bold.cyan Runtime:}
141+
${result.runtime}
137142
{bold.cyan View Live Logs:}
138143
${twilioConsoleLogsLink}
139144
`.trim()

0 commit comments

Comments
 (0)