chore: pre-chore

This commit is contained in:
Leifer Mendez
2023-02-04 18:03:57 +01:00
parent 99b9b17f52
commit 2ecc41f3f0
82 changed files with 411 additions and 904 deletions

View File

@@ -5,15 +5,9 @@ const checkNodeVersion = () => {
return new Promise((resolve, reject) => {
console.log(bgCyan('🚀 Revisando tu Node.js'))
const version = process.version
const majorVersion = parseInt(
version.replace('v', '').split('.').shift()
)
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}`
)
)
console.error(red(`🔴 Se require Node.js 16 o superior. Actualmente esta ejecutando Node.js ${version}`))
console.log(``)
reject('ERROR_NODE')
}

View File

@@ -2,10 +2,7 @@ const rimraf = require('rimraf')
const { yellow } = require('kleur')
const { join } = require('path')
const PATH_WW = [
join(process.cwd(), '.wwebjs_auth'),
join(process.cwd(), 'session.json'),
]
const PATH_WW = [join(process.cwd(), '.wwebjs_auth'), join(process.cwd(), 'session.json')]
const cleanSession = () => {
const queue = []

View File

@@ -23,11 +23,7 @@ const JSON_TEMPLATE = {
const PATH_CONFIG = join(process.cwd(), 'config.json')
const jsonConfig = () => {
return writeFile(
PATH_CONFIG,
JSON.stringify(JSON_TEMPLATE, null, 2),
'utf-8'
)
return writeFile(PATH_CONFIG, JSON.stringify(JSON_TEMPLATE, null, 2), 'utf-8')
}
module.exports = { jsonConfig }

View File

@@ -20,13 +20,9 @@ const installDeps = (pkgManager, packageList) => {
const installSingle = (pkgInstall) => () => {
new Promise((resolve) => {
try {
childProcess = spawn(
pkgManager,
[PKG_OPTION[pkgManager], pkgInstall],
{
stdio: 'inherit',
}
)
childProcess = spawn(pkgManager, [PKG_OPTION[pkgManager], pkgInstall], {
stdio: 'inherit',
})
childProcess.on('error', (e) => {
console.error(e)

View File

@@ -30,9 +30,7 @@ const startInteractive = async () => {
await nextSteps()
} catch (e) {
console.error(bgRed(`Ups! 🙄 algo no va bien.`))
console.error(
bgRed(`Revisa los requerimientos minimos en la documentacion`)
)
console.error(bgRed(`Revisa los requerimientos minimos en la documentacion`))
}
}
@@ -82,8 +80,7 @@ const nextSteps = async () => {
const { outDir = '', providerDb = [], providerWs = [] } = response
const createApp = async (templateName = null) => {
if (!templateName)
throw new Error('TEMPLATE_NAME_INVALID: ', templateName)
if (!templateName) throw new Error('TEMPLATE_NAME_INVALID: ', templateName)
const possiblesPath = [
join(__dirname, '..', '..', 'starters', 'apps', templateName),
@@ -115,11 +112,7 @@ const nextSteps = async () => {
const vendorProvider = async () => {
const [answer] = providerWs
if (!providerWs.length) {
console.log(
red(
`Debes seleccionar un proveedor de whatsapp. Tecla [Space] para seleccionar`
)
)
console.log(red(`Debes seleccionar un proveedor de whatsapp. Tecla [Space] para seleccionar`))
process.exit(1)
}
return answer
@@ -132,11 +125,7 @@ const nextSteps = async () => {
const dbProvider = async () => {
const [answer] = providerDb
if (!providerDb.length) {
console.log(
red(
`Debes seleccionar un proveedor de base de datos. Tecla [Space] para seleccionar`
)
)
console.log(red(`Debes seleccionar un proveedor de base de datos. Tecla [Space] para seleccionar`))
process.exit(1)
}
return answer