From 3574791adeed0c36c6b68e72b78f23889bd3b4dd Mon Sep 17 00:00:00 2001 From: yugasun Date: Fri, 4 Dec 2020 14:51:56 +0800 Subject: [PATCH 1/3] docs: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a21b62..dbd3b32 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Serverless PHP Laravel Tencent Cloud](https://img.serverlesscloud.cn/20191226/1577347087676-website_%E9%95%BF.png)](http://serverless.com) -[![Build Status](https://github.com/serverless-components/tencent-laravel/workflows/Test/badge.svg?branch=master)](https://github.com/serverless-components/tencent-laravel/actions?query=workflow:Test) +[![Build Status](https://github.com/serverless-components/tencent-laravel/workflows/Test/badge.svg)](https://github.com/serverless-components/tencent-laravel/actions?query=workflow:Test)
From 7bd779af406ecb863160b6272ff2bb6395167364 Mon Sep 17 00:00:00 2001 From: Yuga Sun Date: Tue, 15 Dec 2020 15:34:04 +0800 Subject: [PATCH 2/3] fix: update deploy and remove flow (#19) * fix: update to deployment to serial flow * fix: update remove flow --- .github/workflows/test.yml | 2 ++ jest.config.js | 2 +- serverless.component.yml | 2 +- src/package.json | 2 +- src/serverless.js | 27 ++++++++++++++++++--------- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21b004e..c966e94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,5 +41,7 @@ jobs: - name: Running tests run: npm run test env: + SERVERLESS_PLATFORM_VENDOR: tencent + GLOBAL_ACCELERATOR_NA: true TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} diff --git a/jest.config.js b/jest.config.js index 08fa42d..a70dd57 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,7 +4,7 @@ require('dotenv').config({ path: join(__dirname, '.env.test') }) const config = { verbose: true, silent: false, - testTimeout: 60000, + testTimeout: 600000, testEnvironment: 'node', testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$', testPathIgnorePatterns: ['/node_modules/', '/__tests__/lib/'], diff --git a/serverless.component.yml b/serverless.component.yml index 2536442..476edd9 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: laravel -version: 0.1.1 +version: 0.1.2 author: 'Tencent Cloud, Inc' org: 'Tencent Cloud, Inc' description: Deploy a serverless Laravel application on Tencent SCF and API Gateway. diff --git a/src/package.json b/src/package.json index c7e061e..850fa0c 100644 --- a/src/package.json +++ b/src/package.json @@ -1,7 +1,7 @@ { "dependencies": { "download": "^8.0.0", - "tencent-component-toolkit": "^1.19.4", + "tencent-component-toolkit": "^1.19.8", "type": "^2.1.0" } } diff --git a/src/serverless.js b/src/serverless.js index 946563a..bdd8375 100644 --- a/src/serverless.js +++ b/src/serverless.js @@ -196,24 +196,33 @@ class ServerlessComponent 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 + } } this.state.region = regionList[0] @@ -238,10 +247,6 @@ class ServerlessComponent extends Component { const scf = new Scf(credentials, curRegion) const apigw = new Apigw(credentials, curRegion) const handler = async () => { - await scf.remove({ - functionName: curState.functionName, - namespace: curState.namespace - }) // if disable apigw, no need to remove if (state.apigwDisabled !== true) { await apigw.remove({ @@ -252,6 +257,10 @@ class ServerlessComponent extends Component { customDomains: curState.customDomains }) } + await scf.remove({ + functionName: curState.functionName, + namespace: curState.namespace + }) } removeHandlers.push(handler()) } From 8e9e23f3dd1a61094a2890f74929686e7f5a4989 Mon Sep 17 00:00:00 2001 From: slsplus Date: Tue, 15 Dec 2020 07:34:27 +0000 Subject: [PATCH 3/3] chore(release): version 0.1.2 ## [0.1.2](https://github.com/serverless-components/tencent-laravel/compare/v0.1.1...v0.1.2) (2020-12-15) ### Bug Fixes * update deploy and remove flow ([#19](https://github.com/serverless-components/tencent-laravel/issues/19)) ([7bd779a](https://github.com/serverless-components/tencent-laravel/commit/7bd779af406ecb863160b6272ff2bb6395167364)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf9ca66..550d8d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.1.2](https://github.com/serverless-components/tencent-laravel/compare/v0.1.1...v0.1.2) (2020-12-15) + + +### Bug Fixes + +* update deploy and remove flow ([#19](https://github.com/serverless-components/tencent-laravel/issues/19)) ([7bd779a](https://github.com/serverless-components/tencent-laravel/commit/7bd779af406ecb863160b6272ff2bb6395167364)) + ## [0.1.1](https://github.com/serverless-components/tencent-laravel/compare/v0.1.0...v0.1.1) (2020-12-04)