mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-17 19:26:23 +00:00
add validation cli
This commit is contained in:
38
packages/cli/check/index.js
Normal file
38
packages/cli/check/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const { red, yellow, green, bgCyan } = require('kleur')
|
||||
|
||||
const checkNodeVersion = () => {
|
||||
console.log(bgCyan('🚀 Revisando tu Node.js'))
|
||||
const version = process.version
|
||||
const majorVersion = parseInt(version.replace('v', '').split('.').shift())
|
||||
if (majorVersion < 16) {
|
||||
console.error(
|
||||
red(
|
||||
`🔴 Se require Node.js 16 o superior. Actualmente esta ejecutando Node.js ${version}`
|
||||
)
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
console.log(green(`Node.js combatible ${version}`))
|
||||
console.log(``)
|
||||
}
|
||||
|
||||
const checkOs = () => {
|
||||
console.log(bgCyan('🙂 Revisando tu Sistema Operativo'))
|
||||
const os = process.platform
|
||||
if (!os.includes('win32')) {
|
||||
const messages = [
|
||||
`El sistema operativo actual (${os}) posiblemente requiera`,
|
||||
`una confiuración adicional referente al puppeter`,
|
||||
``,
|
||||
`Recuerda pasar por el WIKI`,
|
||||
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalaci%C3%B3n`,
|
||||
``,
|
||||
]
|
||||
|
||||
console.log(yellow(messages.join(' \n')))
|
||||
}
|
||||
|
||||
console.log(``)
|
||||
}
|
||||
|
||||
module.exports = { checkNodeVersion, checkOs }
|
||||
Reference in New Issue
Block a user