[refactor] [s]: update path variable name

This commit is contained in:
Thadeu Cotts
2020-11-24 09:50:13 -03:00
parent 2a9672f5c8
commit 1c8b5e72ce

View File

@@ -6,7 +6,7 @@ const prompts = require('prompts')
const package = require('./package.json') const package = require('./package.json')
// Output path to create new portal app // Output path to create new portal app
let path = '' let projectPath = ''
// Commander parameters to specify CLI behavior // Commander parameters to specify CLI behavior
@@ -17,7 +17,7 @@ program.name(package.name)
.description({ .description({
dir: 'Directory to be used on install Portal.js' dir: 'Directory to be used on install Portal.js'
}) })
.action(name => path = name) .action(name => projectPath = name)
.allowUnknownOption() .allowUnknownOption()
.parse(process.argv) .parse(process.argv)
@@ -44,16 +44,16 @@ program.name(package.name)
* Main method to start CLI and validate inputs * Main method to start CLI and validate inputs
*/ */
async function run(){ async function run(){
if(typeof path === 'string'){ if(typeof projectPath === 'string'){
path = path.trim() projectPath = projectPath.trim()
} }
if(!path){ if(!projectPath){
const response = await promptPath() const response = await promptPath()
if(typeof response.path === 'string'){ if(typeof response.path === 'string'){
path = response.path.trim() projectPath = response.path.trim()
} }
} }
if(!path){ if(!projectPath){
console.log() console.log()
console.log('Please choose a name to your project:') console.log('Please choose a name to your project:')
console.log() console.log()