-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (31 loc) · 1.01 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
const path = require('path')
function init (context) {
}
function initEnv (context, providerMetadata) {
}
function onInitSuccessful (context) {}
function pushResources (context, resourceList) {}
function deleteEnv (context, envName, deleteS3) {}
function configure (context) {}
async function executeAmplifyCommand (context) {
const commandsDirPath = path.normalize(path.join(__dirname, 'commands'))
const commandPath = path.join(commandsDirPath, context.input.command)
const commandModule = require(commandPath)
await commandModule.run(context)
}
async function handleAmplifyEvent (context, args) {
const eventHandlersDirPath = path.normalize(path.join(__dirname, 'event-handlers'))
const eventHandlerPath = path.join(eventHandlersDirPath, `handle-${args.event}`)
const eventHandlerModule = require(eventHandlerPath)
await eventHandlerModule.run(context, args)
}
module.exports = {
init,
onInitSuccessful,
initEnv,
deleteEnv,
configure,
pushResources,
executeAmplifyCommand,
handleAmplifyEvent
}