UNPKG

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