-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.js
41 lines (36 loc) · 1.01 KB
/
serverless.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const { Component } = require('@serverless/core')
class TencentLaravel extends Component {
getIndex() {
const argument = process.argv
for (let i = 0; i <= argument.length; i++) {
if (argument[i] == '-n') {
return i + 1
}
}
return null
}
async getComponent() {
return await this.load('@serverless/tencent-laravel', this.id.split('.')[1])
}
async default(inputs = {}) {
const index = this.getIndex()
if (index) {
if (process.argv[index] && this.id.split('.')[1] === process.argv[index]) {
return (await this.getComponent())(inputs)
}
return {}
}
return (await this.getComponent())(inputs)
}
async remove(inputs = {}) {
const index = this.getIndex()
if (index) {
if (process.argv[index] && this.id.split('.')[1] === process.argv[index]) {
return (await this.getComponent()).remove(inputs)
}
return {}
}
return (await this.getComponent()).remove(inputs)
}
}
module.exports = TencentLaravel