Comparing version 2.0.1 to 2.0.2
@@ -18,2 +18,3 @@ #!/usr/bin/env node | ||
program | ||
.version("1.0.0") | ||
.command("yml") | ||
@@ -38,4 +39,4 @@ .option( | ||
program | ||
.version("1.0.0") | ||
.command("cra") | ||
.allowUnknownOption() | ||
.description( | ||
@@ -42,0 +43,0 @@ "Create a React App using create-react-app with 07_cra_template" |
@@ -28,3 +28,3 @@ /* | ||
Object.values(options).length > 0 && console.log("#".meta); | ||
options.project && console.log(`Project name: ${options.project.info}`); | ||
options.name && console.log(`Project name: ${options.name.info}`); | ||
options.start && | ||
@@ -39,9 +39,9 @@ console.log( | ||
/* ********************************** */ | ||
const createReactApp = (project) => { | ||
if (project) { | ||
let exists = fs.existsSync(`07_cra_${project}`); | ||
const createReactApp = (name) => { | ||
if (name) { | ||
let exists = fs.existsSync(`07_cra_${name}`); | ||
if (!exists) { | ||
if (options.start === true) { | ||
execSync( | ||
`npx create-react-app 07_cra_${project} --template 07 && cd 07_cra_${project} && yarn && yarn start && code .`, | ||
`npx create-react-app 07_cra_${name} --template 07 && cd 07_cra_${name} && yarn && yarn start && code .`, | ||
{ | ||
@@ -53,3 +53,3 @@ stdio: "inherit", | ||
execSync( | ||
`npx create-react-app 07_cra_${project} --template 07`, | ||
`npx create-react-app 07_cra_${name} --template 07`, | ||
{ | ||
@@ -64,3 +64,3 @@ stdio: "inherit", | ||
`\n${e("worried")} Folder already exists: ${ | ||
`07_cra_${project}`.meta | ||
`07_cra_${name}`.meta | ||
}`.error | ||
@@ -76,4 +76,4 @@ ); | ||
// Check for arguments or ask for info | ||
if (options.project) { | ||
createReactApp(options.project); | ||
if (options.name) { | ||
createReactApp(options.name); | ||
} else { | ||
@@ -84,4 +84,4 @@ rl.question( | ||
} `, | ||
function (project) { | ||
project === "" ? rl.close() : createReactApp(project); | ||
function (name) { | ||
name === "" ? rl.close() : createReactApp(name); | ||
} | ||
@@ -88,0 +88,0 @@ ); |
{ | ||
"name": "07-cli", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A command line tool for 07 organization", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
408
58379
6