Skip to content

Commit

Permalink
fix: update to deployment to serial flow
Browse files Browse the repository at this point in the history
  • Loading branch information
yugasun committed Dec 15, 2020
1 parent 1f984ba commit 850dafe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion serverless.component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: nuxtjs
version: 0.1.6
version: 0.1.7
author: 'Tencent Cloud, Inc.'
org: 'Tencent Cloud, Inc.'
description: Deploy a serverless Nuxt.js application onto Tencent SCF and API Gateway.
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": {
"adm-zip": "^0.4.16",
"download": "^8.0.0",
"tencent-component-toolkit": "^1.17.4",
"tencent-component-toolkit": "^1.19.8",
"type": "^2.1.0"
}
}
19 changes: 14 additions & 5 deletions src/serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,24 +258,33 @@ class ServerlessComopnent extends Component {
outputs.templateUrl = CONFIGS.templateUrl
}

const deployTasks = [this.deployFunction(credentials, functionConf, regionList, outputs)]
let apigwOutputs
const functionOutputs = await this.deployFunction(
credentials,
functionConf,
regionList,
outputs
)
// support apigatewayConf.isDisabled
if (apigatewayConf.isDisabled !== true) {
deployTasks.push(this.deployApigateway(credentials, apigatewayConf, regionList, outputs))
apigwOutputs = await this.deployApigateway(credentials, apigatewayConf, regionList, outputs)
} else {
this.state.apigwDisabled = true
}
const [functionOutputs, apigwOutputs = {}] = await Promise.all(deployTasks)

// optimize outputs for one region
if (regionList.length === 1) {
const [oneRegion] = regionList
outputs.region = oneRegion
outputs['apigw'] = apigwOutputs[oneRegion]
outputs['scf'] = functionOutputs[oneRegion]
if (apigwOutputs) {
outputs['apigw'] = apigwOutputs[oneRegion]
}
} else {
outputs['apigw'] = apigwOutputs
outputs['scf'] = functionOutputs
if (apigwOutputs) {
outputs['apigw'] = apigwOutputs
}
}

// start deploy static cdn
Expand Down

0 comments on commit 850dafe

Please sign in to comment.