-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.js
50 lines (41 loc) · 1.14 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
42
43
44
45
46
47
48
49
50
const ensureIterable = require('type/iterable/ensure')
const path = require('path')
const { Component } = require('@serverless/core')
const DEFAULTS = {
handler: 'index.main_handler',
runtime: 'Python3.6',
exclude: ['.git/**', '.gitignore', '.DS_Store']
}
class TencentBottle extends Component {
async default(inputs = {}) {
inputs.include = []
const cachePath = path.join(__dirname, 'component')
inputs.include = ensureIterable(inputs.include, { default: [] })
inputs.include.push(cachePath)
inputs.handelr = DEFAULTS.handler
inputs.runtime = DEFAULTS.runtime
const Framework = await this.load('@serverless/tencent-framework')
const framworkOutpus = await Framework({
...inputs,
...{
framework: 'bottle'
}
})
this.state = framworkOutpus
await this.save()
return framworkOutpus
}
async remove(inputs = {}) {
const Framework = await this.load('@serverless/tencent-framework')
await Framework.remove({
...inputs,
...{
framework: 'bottle'
}
})
this.state = {}
await this.save()
return {}
}
}
module.exports = TencentBottle