From 6649660841e141c0b39c9f18767706d41e0f7d2a Mon Sep 17 00:00:00 2001 From: Jeff Wilde Date: Thu, 3 Aug 2017 10:20:09 -0400 Subject: [PATCH 1/2] Remove erroneous sub-command execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node’s [`spawn`][1] is intended for running external shell executables in sub-processes, not for executing node functions, as seemed the intention in this code. This change removes the use of spawn, instead calling `build` directly. This change should resolve #18. This could be adapted to use [`fork`][2] instead (which is designed to execute a function in a separate v8 process), but there doesn’t seem to be good reason for that here. [1]: https://nodejs.org/dist/v8.2.1/docs/api/child_process.html#child_process_child_process_spawn_command_args_options [2]: https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_child_process_fork_modulepath_args_options --- bin/cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.js b/bin/cli.js index cee01f0..24b11fd 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -13,7 +13,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(chalk.red('Please supply a name for your new React XP app.')); } From eec4c6d8d085e3a2c6afcc691c6e13951cb92b5a Mon Sep 17 00:00:00 2001 From: Jeff Wilde Date: Thu, 3 Aug 2017 10:32:11 -0400 Subject: [PATCH 2/2] Remove figlet problem short-circuit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there’s a problem rendering the ASCII-art banner, the program will exit before doing anything useful and with no error message. Arguably, a user would prefer the program to continue setting up the ReactXP project even if they don’t get to see the banner in its full glory. This change allows the program to continue executing even in the unlikely event that figlet reports a problem, instead falling-back to a regular text output for the banner. --- bin/build.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/build.js b/bin/build.js index 8fea377..119b63e 100644 --- a/bin/build.js +++ b/bin/build.js @@ -49,9 +49,10 @@ const build = (appName) => { font: 'Graffiti' }, function(err, data) { if (err) { - return; + console.log(chalk.white.bold('React XP')); + } else { + console.log(data); } - console.log(data); console.log('----------------------------------------------------------'); console.log(chalk.green.bold('Welcome to ReactXP')); console.log('----------------------------------------------------------');