Skip to content

Commit c76547d

Browse files
author
dfounderliu
committed
Merge remote-tracking branch 'origin/master'
2 parents c0ba6a9 + 790d0f3 commit c76547d

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
coverage
22
dist
33
node_modules
4+
component

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ env.js
2121
package-lock.json
2222
yarn.lock
2323
CHANGELOG.md
24+
component

docs/configure.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ bottle:
4444
4545
Main param description
4646
47-
| Param | Required/Optional | Default | Description |
48-
| --------------------------------------------------- | :---------------: | :----------: | :------------------------------------------------------------------------------------------ |
49-
| region | Optional | ap-guangzhou | |
50-
| functionName | Optional | | ServerlessCloudFunction Name |
51-
| werobotProjectName | required | | Werobot project main file name |
52-
| werobotAttrName | required | | Werobot attribute name |
53-
| serviceName | Optional | | API-Gateway service name, default to create a new serivce |
54-
| serviceId | Optional | | API-Gateway service id, if it has will use this APII-Gateway service |
55-
| code | Optional | | Default is current working directory |
56-
| [functionConf](#funtionConf-param-description) | Optional | | Function configure |
57-
| [apigatewayConf](#apigatewayConf-param-description) | Optional | | API-Gateway configure |
47+
| Param | Required/Optional | Default | Description |
48+
| --------------------------------------------------- | :---------------: | :----------: | :------------------------------------------------------------------- |
49+
| region | Optional | ap-guangzhou | |
50+
| functionName | Optional | | ServerlessCloudFunction Name |
51+
| werobotProjectName | required | | Werobot project main file name |
52+
| werobotAttrName | required | | Werobot attribute name |
53+
| serviceName | Optional | | API-Gateway service name, default to create a new serivce |
54+
| serviceId | Optional | | API-Gateway service id, if it has will use this APII-Gateway service |
55+
| code | Optional | | Default is current working directory |
56+
| [functionConf](#funtionConf-param-description) | Optional | | Function configure |
57+
| [apigatewayConf](#apigatewayConf-param-description) | Optional | | API-Gateway configure |
5858
5959
### funtionConf param description
6060

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
},
4848
"dependencies": {
4949
"@serverless/core": "^1.1.1",
50-
"@serverless/tencent-apigateway": "^2.0.4",
51-
"@serverless/tencent-scf": "^2.0.9",
50+
"@serverless/tencent-apigateway": "^2.1.4",
51+
"@serverless/tencent-scf": "^3.0.0",
5252
"ext": "^1.4.0",
5353
"type": "^2.0.0"
5454
},

serverless.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class TencentWerobot extends Component {
4646
`WerobotComponent_${random({ length: 6 })}`
4747
inputs.codeUri = ensureString(inputs.code, { isOptional: true }) || process.cwd()
4848
inputs.region = ensureString(inputs.region, { default: 'ap-guangzhou' })
49+
inputs.namespace = ensureString(inputs.namespace, { default: 'default' })
4950
inputs.include = ensureIterable(inputs.include, { default: [], ensureItem: ensureString })
5051
inputs.exclude = ensureIterable(inputs.exclude, { default: [], ensureItem: ensureString })
5152
inputs.apigatewayConf = ensurePlainObject(inputs.apigatewayConf, { default: {} })
@@ -57,13 +58,9 @@ class TencentWerobot extends Component {
5758
path.join(path.resolve(inputs.codeUri), '.cache', 'index.py'),
5859
'utf8'
5960
)
60-
const replacedFile = indexPyFile.replace(
61-
eval('/{{werobot_project}}/g'),
62-
inputs.werobotProjectName
63-
).replace(
64-
eval('/{{attribute}}/g'),
65-
inputs.werobotAttrName
66-
)
61+
const replacedFile = indexPyFile
62+
.replace(eval('/{{werobot_project}}/g'), inputs.werobotProjectName)
63+
.replace(eval('/{{attribute}}/g'), inputs.werobotAttrName)
6764
await fs.writeFileSync(
6865
path.join(path.resolve(inputs.codeUri), '.cache', 'index.py'),
6966
replacedFile
@@ -114,10 +111,12 @@ class TencentWerobot extends Component {
114111
method: 'ANY',
115112
function: {
116113
isIntegratedResponse: true,
117-
functionName: tencentCloudFunctionOutputs.Name
114+
functionName: tencentCloudFunctionOutputs.Name,
115+
functionNamespace: inputs.namespace
118116
}
119117
}
120-
]
118+
],
119+
customDomain: inputs.apigatewayConf.customDomain
121120
}
122121

123122
if (inputs.apigatewayConf && inputs.apigatewayConf.auth) {

0 commit comments

Comments
 (0)