UNPKG

r8s-cli

Version:

A command line tool for Reaction Commerce to be used with kubernetes

62 lines (44 loc) 2.06 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.init = init; var _child_process = require('child_process'); var _utils = require('../utils'); var hostingPlatformNotification = '\n********************************************************************************\n ' + _utils.Log.bold('Need help with deployment?') + '\n Learn more about the Reaction Platform: ' + _utils.Log.blue('http://getrxn.io/managed-platform') + '\n********************************************************************************\n'; function init(argv) { _utils.Log.args(argv); var repoUrl = 'https://github.com/reactioncommerce/reaction'; var dirName = argv._[1] || 'reaction'; var branch = argv.branch, tag = argv.tag; if ((0, _utils.exists)(dirName)) { _utils.Log.warn('\nDirectory \'' + dirName + '\' already exists.'); _utils.Log.warn('Use \'reaction init somename\' to install in a different directory.\n'); process.exit(1); } _utils.Log.info('\nCloning the ' + branch + ' branch of Reaction from Github...\n'); try { (0, _child_process.execSync)('git clone -b ' + branch + ' ' + repoUrl + ' ' + dirName, { stdio: 'inherit' }); } catch (err) { _utils.Log.error('\nError: Unable to clone from Github. Exiting.'); process.exit(1); } if (tag) { _utils.Log.info('\nChecking out tag ' + tag + '...\n'); try { (0, _child_process.execSync)('cd ' + dirName + ' && git checkout tags/' + tag + ' -b ' + tag, { stdio: 'inherit' }); } catch (err) { _utils.Log.error('\nError: Failed to checkout tag. Are you sure it exists?'); process.exit(1); } } _utils.Log.info('\nInstalling NPM packages...\n'); (0, _utils.initInstallModules)(dirName); _utils.Log.success('\nReaction successfully installed!'); var blue = _utils.Log.blue; _utils.Log.info('\nTo start your Reaction instance, just run: \n'); _utils.Log.info(blue.bold(' cd ' + dirName)); _utils.Log.info(blue.bold(' reaction\n')); _utils.Log.default(hostingPlatformNotification); }