From 870fd1526452bc5551dccf4de908b5dcbd2f6f0a Mon Sep 17 00:00:00 2001 From: Thadeu Cotts Date: Mon, 23 Nov 2020 17:07:44 -0300 Subject: [PATCH] [feat] [s]: main method to run CLI --- packages/create-portal-app/index.js | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/packages/create-portal-app/index.js b/packages/create-portal-app/index.js index 3cbe6b20..01dfe640 100755 --- a/packages/create-portal-app/index.js +++ b/packages/create-portal-app/index.js @@ -38,4 +38,39 @@ program.name(package.name) } }) + } + + /** + * Main method to start CLI and validate inputs + */ + async function run(){ + if(typeof path === 'string'){ + path = path.trim() + } + if(!path){ + const response = await promptPath() + if(typeof response.path === 'string'){ + path = response.path.trim() + } + } + if(!path){ + console.log() + console.log('Please choose a name to your project:') + console.log() + console.log('Example:') + console.log(`${chalk.cyan(program.name())} ${chalk.yellow('ny-portal-app')}`) + console.log() + + process.exit(1) + } + + /** + * TODO Include workflow to create and manage the files and options + * + * Example: + * createApp() + * .then(installDependencies) + * .then(renameFiles) + * .then(checkUpdated) + */ } \ No newline at end of file