Skip to content

Commit 67a8fd8

Browse files
committed
fix(twilio-run): limit json output in deploy command
The current JSON output was printing all the content of the files deployed. this limits the output
1 parent 5a24ed8 commit 67a8fd8

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

packages/twilio-run/src/printers/deploy.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,44 @@ export function printConfigInfo(
201201
}
202202
}
203203

204+
export function printJsonDeployedResources(
205+
config: DeployLocalProjectConfig,
206+
result: DeployResult
207+
) {
208+
function formatResource(resource: FunctionResource | AssetResource) {
209+
return {
210+
access: resource.access,
211+
path: resource.path,
212+
url: `https://${result.domain}${resource.path}`,
213+
};
214+
}
215+
216+
const data = {
217+
domain: result.domain,
218+
serviceName: result.serviceName,
219+
serviceSid: result.serviceSid,
220+
environmentSuffix: config.functionsEnv,
221+
environmentSid: result.environmentSid,
222+
buildSid: result.buildSid,
223+
runtime: result.runtime,
224+
viewLiveLogs: getTwilioConsoleDeploymentUrl(
225+
result.serviceSid,
226+
result.environmentSid
227+
),
228+
functions: result.functionResources.sort(sortByAccess).map(formatResource),
229+
assets: result.assetResources.sort(sortByAccess).map(formatResource),
230+
};
231+
232+
writeJSONOutput(data);
233+
}
234+
204235
export function printDeployedResources(
205236
config: DeployLocalProjectConfig,
206237
result: DeployResult,
207238
outputFormat: OutputFormat
208239
) {
209240
if (outputFormat === 'json') {
210-
writeJSONOutput(result);
241+
printJsonDeployedResources(config, result);
211242
return;
212243
}
213244
if (shouldPrettyPrint) {

0 commit comments

Comments
 (0)