diff --git a/src/commands/function/deploy.ts b/src/commands/function/deploy.ts index 35b5f66..7d0ecae 100644 --- a/src/commands/function/deploy.ts +++ b/src/commands/function/deploy.ts @@ -119,11 +119,16 @@ const deployFunction = async (functionName: string, functionData: any, options: if (!!data.err) { console.log(Chalk.red(`Deployment unsuccessful, ${data.message}`)) } else { - console.log( - Chalk.green( - `Successfully deployed ${functionName} with id ${functionId}` - ) - ) + console.log(Chalk.green(`Deployment successful!`)); + + const domain = + !!data.domainMappings && + data.domainMappings.length > 0 && + data.domainMappings[0].domain; + + console.log(`${Chalk.blue("Name:")} ${data.functionName}`) + if (domain) console.log(`${Chalk.blue("URL:")} https://${domain}`) + console.log(`${Chalk.blue("CID:")} ${data.functionId}`) } } catch (error: any) { logger.error('Failed to deploy function.', error.message) diff --git a/src/commands/function/list.ts b/src/commands/function/list.ts index 069e9c1..9caee2a 100644 --- a/src/commands/function/list.ts +++ b/src/commands/function/list.ts @@ -12,10 +12,20 @@ export const run = async () => { if (functions && functions.length > 0) { functions.forEach && functions.forEach((f: any) => { + const domain = + !!f.domainMappings && + f.domainMappings.length > 0 && + f.domainMappings[0].domain + logger.log('') - logger.log(`${Chalk.blue('Name:')} ${f.functionName}`) - logger.log(`${Chalk.blue('CID:')} ${f.functionId}`) - logger.log(`${Chalk.blue('Status:')} ${f.status === 'stopped' ? Chalk.red(f.status) : f.status === 'deployed' ? Chalk.green(f.status) : f.status}`) + logger.log(`${Chalk.blue('Name:')} ${f.functionName}`) + + if (domain) { + logger.log(`${Chalk.blue('URL:')} https://${domain}`) + } + + logger.log(`${Chalk.blue('CID:')} ${f.functionId}`) + logger.log(`${Chalk.blue('Status:')} ${f.status === 'stopped' ? Chalk.red(f.status) : f.status === 'deployed' ? Chalk.green(f.status) : f.status}`) }) logger.log('') diff --git a/src/commands/sites/deploy.ts b/src/commands/sites/deploy.ts index 562765a..ed10d81 100644 --- a/src/commands/sites/deploy.ts +++ b/src/commands/sites/deploy.ts @@ -117,11 +117,16 @@ const deployFunction = async (functionName: string, functionData: any, options: if (!!data.err) { console.log(Chalk.red(`Deployment unsuccessful, ${data.message}`)) } else { - console.log( - Chalk.green( - `Successfully deployed ${functionName} with id ${functionId}` - ) - ) + console.log(Chalk.green(`Deployment successful!`)); + + const domain = + !!data.domainMappings && + data.domainMappings.length > 0 && + data.domainMappings[0].domain; + + console.log(`${Chalk.blue("Name:")} ${data.functionName}`) + if (domain) console.log(`${Chalk.blue("URL:")} https://${domain}`) + console.log(`${Chalk.blue("CID:")} ${data.functionId}`) } } catch (error: any) { logger.error('Failed to deploy site.', error.message) diff --git a/src/commands/sites/list.ts b/src/commands/sites/list.ts index a3b9cca..e53d14f 100644 --- a/src/commands/sites/list.ts +++ b/src/commands/sites/list.ts @@ -12,10 +12,20 @@ export const run = async () => { if (sites && sites.length > 0) { sites.forEach && sites.forEach((f: any) => { + const domain = + !!f.domainMappings && + f.domainMappings.length > 0 && + f.domainMappings[0].domain + logger.log('') - logger.log(`${Chalk.blue('Name:')} ${f.functionName}`) - logger.log(`${Chalk.blue('CID:')} ${f.functionId}`) - logger.log(`${Chalk.blue('Status:')} ${f.status === 'stopped' ? Chalk.red(f.status) : f.status === 'deployed' ? Chalk.green(f.status) : f.status}`) + logger.log(`${Chalk.blue('Name:')} ${f.functionName}`) + + if (domain) { + logger.log(`${Chalk.blue('URL:')} https://${domain}`) + } + + logger.log(`${Chalk.blue('CID:')} ${f.functionId}`) + logger.log(`${Chalk.blue('Status:')} ${f.status === 'stopped' ? Chalk.red(f.status) : f.status === 'deployed' ? Chalk.green(f.status) : f.status}`) }) logger.log('')