UNPKG

999 BJavaScriptView Raw
1#!/usr/bin/env node
2
3const program = require('commander'),
4 Gateway = require('./lib/proxy'),
5 logger = require('./lib/logger'),
6 fetchAuthData = require('./lib/settings').fetchSettings,
7 version = require('./package.json').version;
8
9program
10 .version(version)
11 .arguments('[environment]', 'name of the environment. Example: staging')
12 .arguments('<name>', 'name of the module. Example: admin_cms')
13 .option('-c --config-file <config-file>', 'config file path', '.marketplace-kit')
14 .action((environment, name, params) => {
15 process.env.CONFIG_FILE_PATH = params.configFile;
16 const authData = fetchAuthData(environment, program);
17 const gateway = new Gateway(authData);
18 const formData = { pos_module_name: name };
19
20 gateway
21 .removeModule(formData)
22 .then(() => {
23 logger.Success(`[Module Remove] Successfully removed module ${name}`);
24 })
25 .catch(error => logger.Error('Failed to remove the module ', error));
26 });
27
28program.parse(process.argv);