mirror of
https://github.com/aleleba/create-react-ssr.git
synced 2025-01-09 21:46:56 -06:00
commit
f929bad6cf
12
bin/cli.js
12
bin/cli.js
@ -13,13 +13,23 @@ const runCommand = command => {
|
|||||||
return true;
|
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 repoName = process.argv[2];
|
||||||
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-react-ssr ${repoName}`;
|
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-react-ssr ${repoName}`;
|
||||||
console.log(`Cloning the repository with name ${repoName}`);
|
console.log(`Cloning the repository with name ${repoName}`);
|
||||||
const checkedOut = runCommand(gitCheckoutCommand);
|
const checkedOut = runCommand(gitCheckoutCommand);
|
||||||
if(!checkedOut) process.exit(-1);
|
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);
|
if(!actualVersion) process.exit(-1);
|
||||||
|
|
||||||
const installDepsCommand = `cd ${repoName} && npm install`;
|
const installDepsCommand = `cd ${repoName} && npm install`;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@aleleba/create-react-ssr",
|
"name": "@aleleba/create-react-ssr",
|
||||||
"version": "3.0.31",
|
"version": "3.0.32",
|
||||||
"description": "Starter Kit of server side render of react",
|
"description": "Starter Kit of server side render of react",
|
||||||
"bin": "./bin/cli.js",
|
"bin": "./bin/cli.js",
|
||||||
"main": "src/server/index",
|
"main": "src/server/index",
|
||||||
|
Loading…
Reference in New Issue
Block a user