forked from Platform-OS/pos-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
marketplace-kit-sync.js
executable file
·32 lines (27 loc) · 1.07 KB
/
marketplace-kit-sync.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
#!/usr/bin/env node
const program = require('commander'),
spawn = require('child_process').spawn,
command = require('./lib/command'),
fetchAuthData = require('./lib/settings').fetchSettings,
logger = require('./lib/logger'),
validate = require('./lib/validators'),
version = require('./package.json').version;
program
.version(version)
.arguments('[environment]', 'Name of environment. Example: staging')
.option('-c --config-file <config-file>', 'config file path', '.marketplace-kit')
.action((environment, params) => {
process.env.CONFIG_FILE_PATH = params.configFile;
const authData = fetchAuthData(environment, program);
const env = Object.assign(process.env, {
MARKETPLACE_EMAIL: authData.email,
MARKETPLACE_TOKEN: authData.token,
MARKETPLACE_URL: authData.url
});
const p = spawn(command('marketplace-kit-watch'), [], { stdio: 'inherit', env: env });
p.on('close', code => {
if (code === 1) logger.Error('Sync failed.', { exit: false });
});
p.on('error', logger.Error);
});
program.parse(process.argv);