-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (34 loc) · 1.25 KB
/
index.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 _ = require('lodash')
const hooks = require('./hooks')
const commands = require('./commands')
class ServerlessPlugin {
constructor (serverless, options) {
this.serverless = serverless
this.options = options
this.provider = this.serverless.getProvider('aws')
this.config = _.get(this.serverless.service, 'custom.frontend', {})
this.service = this.serverless.service.getServiceObject()
this.commands = {
deploy: {
commands: {
frontend: commands.deploy.command
}
},
remove: {
commands: {
frontend: commands.remove.command
}
}
}
this.hooks = {
'before:package:finalize': hooks.beforePackageFinalize.execute.bind(this),
'before:remove:remove': hooks.beforeRemove.execute.bind(this),
'before:deploy:frontend:execute': commands.deploy.controller.before.bind(this),
'deploy:frontend:execute': commands.deploy.controller.execute.bind(this),
'after:deploy:frontend:execute': commands.deploy.controller.after.bind(this),
'remove:frontend:execute': commands.remove.controller.execute.bind(this),
'after:aws:info:displayServiceInfo': hooks.displayServiceInfo.execute.bind(this)
}
}
}
module.exports = ServerlessPlugin