-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
37 lines (33 loc) · 1.15 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
const RunPluginScriptCommand = require('./src/commands/runPluginScript')
const CreateProjectCommand = require('./src/commands/createProject')
const AddPluginsCommand = require('./src/commands/addPlugins')
const RemovePluginsCommand = require('./src/commands/removePlugins')
const UpdatePluginsCommand = require('./src/commands/updatePlugins')
const GenerateCommand = require('./src/commands/generate')
const CommitCommand = require('./src/commands/commit')
const ReleaseCommand = require('./src/commands/release')
const AssembleCommand = require('./src/commands/assemble')
const MigrateCommand = require('./src/commands/migrate')
const commands = [
RunPluginScriptCommand,
CreateProjectCommand,
AddPluginsCommand,
RemovePluginsCommand,
UpdatePluginsCommand,
GenerateCommand,
CommitCommand,
AssembleCommand,
ReleaseCommand,
MigrateCommand,
]
const runCommand = (commandName, argv, params, options) => {
const Command = commands.find(command => command.commandName === commandName)
if (!Command) {
throw new Error('Can\'t find command')
}
const command = new Command(argv, options)
return command.run(params)
}
module.exports = {
runCommand,
}