Skip to content

Commit

Permalink
Display function & sites linked domain during deployment and listing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
uditdc authored Jul 10, 2023
1 parent 87ff197 commit f455795
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
15 changes: 10 additions & 5 deletions src/commands/function/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 13 additions & 3 deletions src/commands/function/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
Expand Down
15 changes: 10 additions & 5 deletions src/commands/sites/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 13 additions & 3 deletions src/commands/sites/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
Expand Down

0 comments on commit f455795

Please sign in to comment.