Skip to content

Commit

Permalink
feat: make installation of Bower deps optional (#66)
Browse files Browse the repository at this point in the history
NodeCG is soon to remove its dependency on Bower entirely, so there might not be a `bower.json` present when setting up a new NodeCG instance. Therefore, we must check for the presence of a `bower.json` file before attempting to run `bower install`.
  • Loading branch information
Alex Van Camp authored Aug 6, 2019
1 parent 9b47ffc commit 2e16c1b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ function installDependencies() {
return;
}

process.stdout.write('Installing production bower dependencies... ');
try {
execSync('bower install --production', {stdio: ['pipe', 'pipe', 'pipe']});
process.stdout.write(chalk.green('done!') + os.EOL);
} catch (e) {
process.stdout.write(chalk.red('failed!') + os.EOL);
console.error(e.stack);
if (fs.existsSync('./bower.json')) {
process.stdout.write('Installing production bower dependencies... ');
try {
execSync('bower install --production', {stdio: ['pipe', 'pipe', 'pipe']});
process.stdout.write(chalk.green('done!') + os.EOL);
} catch (e) {
process.stdout.write(chalk.red('failed!') + os.EOL);
console.error(e.stack);
}
}
}

Expand Down

0 comments on commit 2e16c1b

Please sign in to comment.