Skip to content

Commit

Permalink
CLI fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Stokolosa committed Aug 7, 2018
1 parent 90d7269 commit c157b80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
13 changes: 1 addition & 12 deletions cli/build.js
Expand Up @@ -4,25 +4,14 @@ require('shelljs/global');
const path = require('path');
const fs = require('fs');
const chalk = require('chalk');
const execSync = require('child_process').execSync;
const spawn = require('cross-spawn');

function shouldUseYarn() {
try {
execSync('yarnpkg --version', { stdio: 'ignore' });

return true;
} catch (error) {
return false;
}
}

const installPackages = () => {
console.log(chalk.white.bold('Installing Packages'));
console.log('----------------------------------------------------------');

return new Promise((resolve, reject) => {
let command = shouldUseYarn() ? 'yarn' : 'npm';
let command = 'yarn';
let args = ['install'];

const child = spawn(command, args, { stdio: 'inherit' });
Expand Down
3 changes: 1 addition & 2 deletions cli/cli.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node

const program = require('commander');
const spawn = require('child_process').spawn;
const package = require('./../package.json');
const chalk = require('chalk');
const build = require('./build');
Expand All @@ -12,7 +11,7 @@ program
.parse(process.argv);

if (program.args.length > 0) {
spawn(build(program.args[0]), { shell: true, stdio: 'inherit' });
build(program.args[0]);
} else if (program.args.length < 1) {
console.log('----------------------------------------------------------');
console.log(chalk.red('Please supply a name for your new React Redux app structure'));
Expand Down

0 comments on commit c157b80

Please sign in to comment.