mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 20:49:15 +00:00
Merge pull request #492 from codigoencasa/fix/refactor-cb
Fix/refactor cb
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.1.17](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.16...v0.1.17) (2023-01-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* mod de starters para habiltar portal ([eceb170](https://github.com/leifermendez/bot-whatsapp/commit/eceb170df03721dca4183b658c863b94fa04bc84))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **ci:** pre-release ([aaec075](https://github.com/leifermendez/bot-whatsapp/commit/aaec0751408ab49483d428810d94aaf7d46acb94))
|
||||||
|
* correccion en starters app.js para portal QR ([f430380](https://github.com/leifermendez/bot-whatsapp/commit/f430380b4f23d41702395c96c628bf13bf443278))
|
||||||
|
* **starters:** :zap: added dockerfile ([230981e](https://github.com/leifermendez/bot-whatsapp/commit/230981e2676361149cb2a99def7f705e75009260))
|
||||||
|
|
||||||
### [0.1.16](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.15...v0.1.16) (2023-01-11)
|
### [0.1.16](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.15...v0.1.16) (2023-01-11)
|
||||||
|
|
||||||
### [0.1.15](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.14...v0.1.15) (2023-01-11)
|
### [0.1.15](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.14...v0.1.15) (2023-01-11)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/root",
|
"name": "@bot-whatsapp/root",
|
||||||
"version": "0.1.16",
|
"version": "0.1.17",
|
||||||
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
|
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -2,50 +2,64 @@ const { red, yellow, green, bgCyan } = require('kleur')
|
|||||||
const { exec } = require('node:child_process')
|
const { exec } = require('node:child_process')
|
||||||
|
|
||||||
const checkNodeVersion = () => {
|
const checkNodeVersion = () => {
|
||||||
console.log(bgCyan('🚀 Revisando tu Node.js'))
|
return new Promise((resolve, reject) => {
|
||||||
const version = process.version
|
console.log(bgCyan('🚀 Revisando tu Node.js'))
|
||||||
const majorVersion = parseInt(version.replace('v', '').split('.').shift())
|
const version = process.version
|
||||||
if (majorVersion < 16) {
|
const majorVersion = parseInt(
|
||||||
console.error(
|
version.replace('v', '').split('.').shift()
|
||||||
red(
|
|
||||||
`🔴 Se require Node.js 16 o superior. Actualmente esta ejecutando Node.js ${version}`
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
process.exit(1)
|
if (majorVersion < 16) {
|
||||||
}
|
console.error(
|
||||||
console.log(green(`Node.js: ${version} compatible ✅`))
|
red(
|
||||||
console.log(``)
|
`🔴 Se require Node.js 16 o superior. Actualmente esta ejecutando Node.js ${version}`
|
||||||
|
)
|
||||||
|
)
|
||||||
|
console.log(``)
|
||||||
|
reject('ERROR_NODE')
|
||||||
|
}
|
||||||
|
console.log(green(`Node.js: ${version} compatible ✅`))
|
||||||
|
console.log(``)
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkOs = () => {
|
const checkOs = () => {
|
||||||
console.log(bgCyan('🙂 Revisando tu sistema operativo'))
|
return new Promise((resolve, reject) => {
|
||||||
const os = process.platform
|
console.log(bgCyan('🙂 Revisando tu sistema operativo'))
|
||||||
if (!os.includes('win32')) {
|
const os = process.platform
|
||||||
const messages = [
|
if (!os.includes('win32')) {
|
||||||
`El sistema operativo actual (${os}) posiblemente requiera`,
|
const messages = [
|
||||||
`una configuración adicional referente al puppeteer`,
|
`El sistema operativo actual (${os}) posiblemente requiera`,
|
||||||
``,
|
`una configuración adicional referente al puppeteer`,
|
||||||
`Recuerda pasar por el WIKI`,
|
``,
|
||||||
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`,
|
`Recuerda pasar por el WIKI`,
|
||||||
``,
|
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`,
|
||||||
]
|
``,
|
||||||
|
]
|
||||||
|
|
||||||
console.log(yellow(messages.join(' \n')))
|
console.log(yellow(messages.join(' \n')))
|
||||||
}
|
}
|
||||||
console.log(green(`OS: compatible ✅`))
|
console.log(green(`OS: compatible ✅`))
|
||||||
console.log(``)
|
console.log(``)
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkGit = () => {
|
const checkGit = () => {
|
||||||
console.log(bgCyan('🤓 Revisando GIT'))
|
return new Promise((resolve, reject) => {
|
||||||
exec('git --version', (error) => {
|
console.log(bgCyan('🤓 Revisando GIT'))
|
||||||
if (error) {
|
exec('git --version', (error) => {
|
||||||
console.error(red(`🔴 Se require instalar GIT`))
|
if (error) {
|
||||||
process.exit(1)
|
console.error(red(`🔴 Se require instalar GIT`))
|
||||||
}
|
console.log(``)
|
||||||
|
reject('ERROR_GIT')
|
||||||
|
} else {
|
||||||
|
console.log(green(`Git: Compatible ✅`))
|
||||||
|
console.log(``)
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
console.log(green(`Git: Compatible ✅`))
|
|
||||||
console.log(``)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { checkNodeVersion, checkOs, checkGit }
|
module.exports = { checkNodeVersion, checkOs, checkGit }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const prompts = require('prompts')
|
const prompts = require('prompts')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
const { yellow, red, cyan, bgMagenta } = require('kleur')
|
const { yellow, red, cyan, bgMagenta, bgRed } = require('kleur')
|
||||||
const { existsSync } = require('fs')
|
const { existsSync } = require('fs')
|
||||||
const { copyBaseApp } = require('../create-app')
|
const { copyBaseApp } = require('../create-app')
|
||||||
const { checkNodeVersion, checkOs, checkGit } = require('../check')
|
const { checkNodeVersion, checkOs, checkGit } = require('../check')
|
||||||
@@ -21,6 +21,22 @@ const bannerDone = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const startInteractive = async () => {
|
const startInteractive = async () => {
|
||||||
|
try {
|
||||||
|
console.clear()
|
||||||
|
await checkNodeVersion()
|
||||||
|
checkOs()
|
||||||
|
await checkGit()
|
||||||
|
console.clear()
|
||||||
|
await nextSteps()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(bgRed(`Ups! 🙄 algo no va bien.`))
|
||||||
|
console.error(
|
||||||
|
bgRed(`Revisa los requerimientos minimos en la documentacion`)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextSteps = async () => {
|
||||||
const questions = [
|
const questions = [
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@@ -58,10 +74,6 @@ const startInteractive = async () => {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
console.clear()
|
|
||||||
checkOs()
|
|
||||||
checkNodeVersion()
|
|
||||||
checkGit()
|
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
console.log('¡Proceso cancelado!')
|
console.log('¡Proceso cancelado!')
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-bot-whatsapp",
|
"name": "create-bot-whatsapp",
|
||||||
"version": "0.0.82-alpha.0",
|
"version": "0.0.92-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
Reference in New Issue
Block a user