-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
46 lines (36 loc) · 1.56 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
42
43
44
45
46
'use strict';
const actions = require('./src')
const _static = require('./src/__make_options')
module.exports = class ServerlessStaticServePlugin {
constructor(serverless, options) {
const static_env = _static( serverless, options ) // generate static object with all options available to the functions
this.commands = {
static: {
usage: 'serve local directory',
lifecycleEvents: ['start'],
commands: {
serve: {
usage: 'serve local directory',
lifecycleEvents: [ 'start' ],
},
sync: {
usage: 'sync local directory with bucket speficied inside serverless.yml file',
lifecycleEvents: [ 'start' ],
}
}
}
};
this.hooks = {
// lifecycle hooks for static:serve
"before:offline:start:init": actions.serve.bind( this, serverless, static_env ), // hook from serverless-offline
"before:offline:start": actions.serve.bind( this, serverless, static_env ), // hook from serverless-offline
'static:serve:start': actions.serve.bind( this, serverless, static_env ),
// 'static:serve': actions.serve.bind( null, serverless, static_env ),
// // lifecycle hooks for statis:sync
// "aws:deploy:deploy:uploadArtifacts": actions.sync.bind( null, serverless, static_env ),
"static:sync:start": actions.sync.bind( this, serverless, static_env ),
"static:start": actions.sync.bind( this, serverless, static_env ),
"deploy:initialize": actions.sync.bind( this, serverless, static_env )
};
}
}