Skip to content

Commit 96879d4

Browse files
authored
fix: update remove flow (#17)
* fix: update remove flow * fix: update deps
1 parent cb2937b commit 96879d4

File tree

10 files changed

+26
-19
lines changed

10 files changed

+26
-19
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ jobs:
4343
env:
4444
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
4545
GIT_AUTHOR_NAME: slsplus
46-
GIT_AUTHOR_EMAIL: yuga.sun.bj@gmail.com
46+
GIT_AUTHOR_EMAIL: slsplus.sz@gmail.com
4747
GIT_COMMITTER_NAME: slsplus
48-
GIT_COMMITTER_EMAIL: yuga.sun.bj@gmail.com
48+
GIT_COMMITTER_EMAIL: slsplus.sz@gmail.com

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: |
3939
npm update --no-save
4040
npm update --save-dev --no-save
41-
- name: Running integration tests
41+
- name: Running tests
4242
run: npm run test
4343
env:
4444
SERVERLESS_PLATFORM_VENDOR: tencent

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ serverless deploy
5858

5959
> **说明**:如果鉴权失败,请参考 [权限配置](https://cloud.tencent.com/document/product/1154/43006) 进行授权。
6060
61-
6261
### 4. 配置
6362

6463
nuxtjs 组件支持 0 配置部署,也就是可以直接通过配置文件中的默认值进行部署。但你依然可以修改更多可选配置来进一步开发该 nuxtjs 项目。

tests/integration.test.js renamed to __tests__/index.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
require('dotenv').config()
2-
const { generateId, getServerlessSdk } = require('./utils')
2+
const { generateId, getServerlessSdk } = require('./lib/utils')
33
const axios = require('axios')
44

5-
// set enough timeout for deployment to finish
6-
jest.setTimeout(600000)
7-
8-
// the yaml file we're testing against
95
const instanceYaml = {
106
org: 'orgDemo',
117
app: 'appDemo',
12-
component: 'nuxtjs',
8+
component: 'nuxtjs@dev',
139
name: `nuxtjs-integration-tests-${generateId()}`,
1410
stage: 'dev',
1511
inputs: {
@@ -19,15 +15,13 @@ const instanceYaml = {
1915
}
2016
}
2117

22-
// get credentials from process.env but need to init empty credentials object
2318
const credentials = {
2419
tencent: {
2520
SecretId: process.env.TENCENT_SECRET_ID,
2621
SecretKey: process.env.TENCENT_SECRET_KEY,
2722
}
2823
}
2924

30-
// get serverless construct sdk
3125
const sdk = getServerlessSdk(instanceYaml.org)
3226

3327
it('should successfully deploy nuxtjs app', async () => {
File renamed without changes.

jest.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const { join } = require('path')
2+
require('dotenv').config({ path: join(__dirname, '.env.test') })
3+
4+
const config = {
5+
verbose: true,
6+
silent: false,
7+
testTimeout: 600000,
8+
testEnvironment: 'node',
9+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$',
10+
testPathIgnorePatterns: ['/node_modules/', '/__tests__/lib/'],
11+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
12+
}
13+
14+
module.exports = config

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"description": "Tencent Cloud Nuxt.js Serverless Component",
88
"scripts": {
9-
"test": "jest ./tests/integration.test.js --testEnvironment node",
9+
"test": "jest",
1010
"commitlint": "commitlint -f HEAD@{15}",
1111
"lint": "eslint --ext .js,.ts,.tsx .",
1212
"lint:fix": "eslint --fix --ext .js,.ts,.tsx .",

serverless.component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nuxtjs
2-
version: 0.1.7
2+
version: 0.1.8
33
author: 'Tencent Cloud, Inc.'
44
org: 'Tencent Cloud, Inc.'
55
description: Deploy a serverless Nuxt.js application onto Tencent SCF and API Gateway.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": {
33
"adm-zip": "^0.4.16",
44
"download": "^8.0.0",
5-
"tencent-component-toolkit": "^1.19.8",
5+
"tencent-component-toolkit": "^1.20.5",
66
"type": "^2.1.0"
77
}
88
}

src/serverless.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,6 @@ class ServerlessComopnent extends Component {
358358
const scf = new Scf(credentials, curRegion)
359359
const apigw = new Apigw(credentials, curRegion)
360360
const handler = async () => {
361-
await scf.remove({
362-
functionName: curState.functionName,
363-
namespace: curState.namespace
364-
})
365361
// if disable apigw, no need to remove
366362
if (state.apigwDisabled !== true) {
367363
await apigw.remove({
@@ -372,6 +368,10 @@ class ServerlessComopnent extends Component {
372368
customDomains: curState.customDomains
373369
})
374370
}
371+
await scf.remove({
372+
functionName: curState.functionName,
373+
namespace: curState.namespace
374+
})
375375
}
376376
removeHandlers.push(handler())
377377
}

0 commit comments

Comments
 (0)