[pkg] [s]: validate package manager before run script

This commit is contained in:
Thadeu Cotts
2020-12-01 10:08:28 -03:00
parent eab57b6fe1
commit 47fc045d68

View File

@@ -55,15 +55,25 @@ async function promptPath() {
* Main method to start CLI and validate inputs * Main method to start CLI and validate inputs
*/ */
async function run() { async function run() {
if(checkPackageVersion(program.useNpm? 'npm' : 'yarn')) {
console.log()
console.log(`${chalk.yellowBright('Your package manager version is outdated, please update before continue.')}`)
console.log()
return
}
if (typeof projectPath === 'string') { if (typeof projectPath === 'string') {
projectPath = projectPath.trim() projectPath = projectPath.trim()
} }
if (!projectPath) { if (!projectPath) {
const response = await promptPath() const response = await promptPath()
if (typeof response.path === 'string') { if (typeof response.path === 'string') {
projectPath = response.path.trim() projectPath = response.path.trim()
} }
} }
if (!projectPath) { if (!projectPath) {
//TODO separate log methods //TODO separate log methods
console.log() console.log()