From ee0fdaae9aeaf452c90216d44de565b340bda355 Mon Sep 17 00:00:00 2001 From: Alejandro Lembke Barrientos Date: Thu, 4 Aug 2022 16:35:09 +0000 Subject: [PATCH] PR-865862: fixing npx. --- bin/cli.js | 12 +++++++++++- package.json | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index fbbd938..795a3de 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -13,13 +13,23 @@ const runCommand = command => { return true; } +const runCommandWithOutput = command => { + try{ + return execSync(`${command}`, {stdio: 'inherit'}); + } catch (e) { + console.error(`Failed to execute ${command}`, e); + return false; + } +} + const repoName = process.argv[2]; const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-react-ssr ${repoName}`; console.log(`Cloning the repository with name ${repoName}`); const checkedOut = runCommand(gitCheckoutCommand); if(!checkedOut) process.exit(-1); -const actualVersion = runCommand(`cd ${repoName} && node -p "require('./package.json').version"`) +const actualVersion = runCommandWithOutput(`cd ${repoName} && node -p "require('./package.json').version"`) +console.log(actualVersion) if(!actualVersion) process.exit(-1); const installDepsCommand = `cd ${repoName} && npm install`; diff --git a/package.json b/package.json index 36c3f04..4256894 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aleleba/create-react-ssr", - "version": "3.0.31", + "version": "3.0.32", "description": "Starter Kit of server side render of react", "bin": "./bin/cli.js", "main": "src/server/index",