Merge pull request #503 from codigoencasa/dev

Dev
This commit is contained in:
Leifer Mendez
2023-01-16 14:48:47 +01:00
committed by GitHub
29 changed files with 340 additions and 50 deletions

View File

@@ -39,8 +39,14 @@ jobs:
- name: Check Twilio
run: yarn node ./scripts/checker.js --name=twilio --stable=true
- name: Add and commit changes to gh-pages branch
run: |
git config --local user.email 'action@github.com'
git config --local user.name 'GitHub Action'
git add .
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'ci(providers): 🚩 Check BREAKING CHANGE'
commit_message: 'ci(providers): check provider versions'
create_branch: true
branch: feature/breaking-change
branch: feature/providers-major

View File

@@ -56,3 +56,55 @@ jobs:
- name: Unit Tests
run: yarn test
############ UNIT TEST ############
check-providers:
name: Check Providers Versions
runs-on: ubuntu-latest
outputs:
commit: ${{ steps.vars.outputs.commit }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{github.event.after}}
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Install NPM Dependencies
run: yarn install --immutable --network-timeout 300000
- name: Check Baileys
run: yarn node ./scripts/checker.js --name=baileys --stable=true
- name: Check Venom
run: yarn node ./scripts/checker.js --name=venom --stable=true
- name: Check web-whatsapp
run: yarn node ./scripts/checker.js --name=web-whatsapp --stable=true
- name: Check Meta
run: yarn node ./scripts/checker.js --name=meta --stable=true
- name: Check Twilio
run: yarn node ./scripts/checker.js --name=twilio --stable=true
- name: Set output
id: vars
run: echo "commit=$(git log --format=%B -n 1 ${{github.event.after}})" >> $GITHUB_OUTPUT
- name: Commit & Push changes
uses: actions-js/push@master
with:
branch: feature/providers-major
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true

View File

@@ -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.
### [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.15](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.14...v0.1.15) (2023-01-11)

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/root",
"version": "0.1.16",
"version": "0.1.17",
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
"main": "app.js",
"private": true,

View File

@@ -70,7 +70,7 @@ class CoreClass {
const { body, from } = messageCtxInComming
let msgToSend = []
let fallBackFlag = false
if (!body) return
if (!body.length) return
const prevMsg = await this.databaseClass.getPrevByNumber(from)

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/bot",
"version": "0.0.64-alpha.0",
"version": "0.0.66-alpha.0",
"description": "",
"main": "./lib/bundle.bot.cjs",
"scripts": {

View File

@@ -1,38 +1,65 @@
const { red, yellow, green, bgCyan } = require('kleur')
const { exec } = require('node:child_process')
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}`
)
return new Promise((resolve, reject) => {
console.log(bgCyan('🚀 Revisando tu Node.js'))
const version = process.version
const majorVersion = parseInt(
version.replace('v', '').split('.').shift()
)
process.exit(1)
}
console.log(green(`Node.js compatible ${version}`))
console.log(``)
if (majorVersion < 16) {
console.error(
red(
`🔴 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 = () => {
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 configuración adicional referente al puppeteer`,
``,
`Recuerda pasar por el WIKI`,
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`,
``,
]
return new Promise((resolve) => {
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 configuración adicional referente al puppeteer`,
``,
`Recuerda pasar por el WIKI`,
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`,
``,
]
console.log(yellow(messages.join(' \n')))
}
console.log(``)
console.log(yellow(messages.join(' \n')))
}
console.log(green(`OS: compatible ✅`))
console.log(``)
resolve()
})
}
module.exports = { checkNodeVersion, checkOs }
const checkGit = () => {
return new Promise((resolve, reject) => {
console.log(bgCyan('🤓 Revisando GIT'))
exec('git --version', (error) => {
if (error) {
console.error(red(`🔴 Se require instalar GIT`))
console.log(``)
reject('ERROR_GIT')
} else {
console.log(green(`Git: Compatible ✅`))
console.log(``)
resolve()
}
})
})
}
module.exports = { checkNodeVersion, checkOs, checkGit }

View File

@@ -1,9 +1,9 @@
const prompts = require('prompts')
const { join } = require('path')
const { yellow, red, cyan, bgMagenta } = require('kleur')
const { yellow, red, cyan, bgMagenta, bgRed } = require('kleur')
const { existsSync } = require('fs')
const { copyBaseApp } = require('../create-app')
const { checkNodeVersion, checkOs } = require('../check')
const { checkNodeVersion, checkOs, checkGit } = require('../check')
const bannerDone = () => {
console.log(``)
@@ -21,6 +21,22 @@ const bannerDone = () => {
}
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 = [
{
type: 'text',
@@ -58,9 +74,6 @@ const startInteractive = async () => {
},
]
console.clear()
checkNodeVersion()
checkOs()
const onCancel = () => {
console.log('¡Proceso cancelado!')
return true

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/cli",
"version": "0.0.70-alpha.0",
"version": "0.0.72-alpha.0",
"description": "",
"main": "index.js",
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/contexts",
"version": "0.0.14-alpha.0",
"version": "0.0.16-alpha.0",
"description": "",
"main": "./lib/bundle.contexts.cjs",
"files": [

View File

@@ -1,6 +1,6 @@
{
"name": "create-bot-whatsapp",
"version": "0.0.81-alpha.0",
"version": "0.0.93-alpha.0",
"description": "",
"main": "./lib/bundle.create-bot-whatsapp.cjs",
"files": [

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/database",
"version": "0.0.62-alpha.0",
"version": "0.0.64-alpha.0",
"description": "Esto es el conector a mysql, pg, mongo",
"main": "./lib/mock/index.cjs",
"keywords": [],

View File

@@ -6,7 +6,9 @@ A continuación se describen los puntos técnicos que debes de tener en cuenta a
- Node v16 o superior - **[descargar node](https://nodejs.org/es/download/)**
- Git - **[descargar Git](https://git-scm.com/download/win)**
---
## ¿Como saber que tengo el Node?
Solo debes ejecutar el siguiente comando y esperar que la versión que te arroja sea superior a v16
@@ -15,12 +17,16 @@ Solo debes ejecutar el siguiente comando y esperar que la versión que te arroja
$ node -v
v18.12.1
```
---
## ¿Como instalar Node?
- **Windows**: [Ver video](https://youtu.be/xRXHQlqA3Ak?t=376). Si necesitas ayuda para instalar Node en Windows. A continuación te comparto un video en el minuto exacto donde explico como instalar.
- **Ubuntu**: Te comparto un recurso de **[Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04-es)** donde explica como instalar node en Ubuntu.
- ---
---
## ¿Como saber que tengo Git?
Solo debes ejecutar el siguiente comando y esperar que te mande la versión que tienes instalada, si te manda un error de comando no reconocido es que no lo tienes instalado.
@@ -29,7 +35,9 @@ Solo debes ejecutar el siguiente comando y esperar que te mande la versión que
$ git -v
git
```
---
## ¿Como instalar Git?
- Solo es necesario instalar Git si estás usando **Windows**, ya que Mac y Linux lo traen preinstalado.
@@ -37,6 +45,7 @@ git
- Descarga la versión necesaria para tu sistema operativo (32-bit o 64-bit).
- Una vez terminada la descarga, ejecuta el archivo descargado y dale "Siguiente" en todas las pantallas.
- Haz clic en el botón de "Finalizar".
---
<Navigation

View File

@@ -0,0 +1,4 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "unifiedjs.vscode-mdx"],
"unwantedRecommendations": []
}

View File

@@ -0,0 +1,32 @@
{
"onGet": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:onGet",
"description": "onGet function for a route index",
"body": [
"export const onGet: RequestHandler = (request) => {",
" $0",
"};"
]
},
"onGet (typed)": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:onGet typed",
"description": "onGet function for a route index",
"body": [
"export interface ${1:PageData} {",
" $2",
"};",
"",
"export const onGet: RequestHandler<$1> = (request) => {",
" $4",
"};"
]
},
"useEndpoint": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useEndpoint",
"description": "useEndpoint declaration",
"body": "const $1 = useEndpoint<typeof onGet>();"
}
}

View File

@@ -0,0 +1,84 @@
{
"Qwik component (simple)": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:component",
"description": "Simple Qwik component",
"body": [
"export const ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}} = component$(() => {",
" return <${2:div}>$4</$2>",
"});"
]
},
"Qwik component (props)": {
"scope": "typescriptreact",
"prefix": "q:component w/props",
"description": "Qwik component w/ props",
"body": [
"export interface ${1:${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}}Props {",
" $2",
"}",
"",
"export const $1 = component$<$1Props>((props) => {",
" const ${2:count} = useSignal(0);",
" return (",
" <${3:div} on${4:Click}$={(ev) => {$5}}>",
" $6",
" </${3}>",
" );",
"});"
]
},
"Qwik signal": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useSignal",
"description": "useSignal() declaration",
"body": ["const ${1:foo} = useSignal($2);", "$0"]
},
"Qwik store": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useStore",
"description": "useStore() declaration",
"body": ["const ${1:state} = useStore({", " $2", "});", "$0"]
},
"$ hook": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:$",
"description": "$() function hook",
"body": ["$(() => {", " $0", "});", ""]
},
"useClientEffect": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useClientEffect",
"description": "useClientEffect$() function hook",
"body": ["useClientEffect$(({ track }) => {", " $0", "});", ""]
},
"useTask": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useTask",
"description": "useTask$() function hook",
"body": [
"useTask$(({ track }) => {",
" track(() => $1);",
" $0",
"});",
""
]
},
"useResource": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useResource",
"description": "useResource$() declaration",
"body": [
"const $1 = useResource$(({ track, cleanup }) => {",
" $0",
"});",
""
]
},
"useServerMount": {
"scope": "javascriptreact,typescriptreact",
"prefix": "q:useServerMount",
"description": "useServerMount$() function hook",
"body": ["useServerMount$(() => {", " $0", "});", ""]
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/portal",
"version": "0.0.20-alpha.0",
"version": "0.0.22-alpha.0",
"description": "Portal WEB para escanear QR",
"main": "./lib/portal.http.cjs",
"scripts": {

View File

@@ -0,0 +1,15 @@
const notFounds = [
[
'/',
'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n <meta http-equiv="Status" content="404"/>\n <title>404 Resource Not Found</title>\n <meta name="viewport" content="width=device-width,initial-scale=1">\n <style>\n body { color: #006ce9; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }\n p { max-width: 600px; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px #006ce9; overflow: hidden; }\n strong { display: inline-block; padding: 15px; background: #006ce9; color: white; }\n span { display: inline-block; padding: 15px; }\n pre { max-width: 580px; margin: 0 auto; }\n </style>\n</head>\n<body>\n <p><strong>404</strong> <span>Resource Not Found</span></p>\n</body>\n</html>',
],
]
function getNotFound(p) {
for (const r of notFounds) {
if (p.startsWith(r[0])) {
return r[1]
}
}
return 'Resource Not Found'
}
export { getNotFound }

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
const staticPaths = new Set([
'/',
'/favicon.svg',
'/manifest.json',
'/q-manifest.json',
'/robots.txt',
'/service-worker.js',
'/sitemap.xml',
'/water-mark.png',
])
function isStaticPath(p) {
if (p.startsWith('/build/')) {
return true
}
if (p.startsWith('/assets/')) {
return true
}
if (staticPaths.has(p)) {
return true
}
return false
}
export { isStaticPath }

View File

@@ -0,0 +1 @@
export * from './entry.ssr.mjs'

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/provider",
"version": "0.0.68-alpha.0",
"version": "0.0.70-alpha.0",
"description": "Esto es el conector a Twilio, Meta, etc...",
"main": "./lib/mock/index.cjs",
"keywords": [],

View File

@@ -1,5 +1,5 @@
{
"dependencies": {
"whatsapp-web.js": "1.18.4"
"whatsapp-web.js": "1.19.2"
}
}

View File

@@ -14,7 +14,7 @@
"@bot-whatsapp/database": "latest",
"@bot-whatsapp/provider": "latest",
"@bot-whatsapp/portal": "latest",
"whatsapp-web.js": "1.18.4"
"whatsapp-web.js": "1.19.2"
},
"author": "",
"license": "ISC"

View File

@@ -14,7 +14,7 @@
"@bot-whatsapp/database": "latest",
"@bot-whatsapp/provider": "latest",
"@bot-whatsapp/portal": "latest",
"whatsapp-web.js": "1.18.4"
"whatsapp-web.js": "1.19.2"
},
"author": "",
"license": "ISC"

View File

@@ -9,7 +9,7 @@
},
"keywords": [],
"dependencies": {
"whatsapp-web.js": "1.18.4",
"whatsapp-web.js": "1.19.2",
"@bot-whatsapp/bot": "latest",
"@bot-whatsapp/cli": "latest",
"@bot-whatsapp/database": "latest",

View File

@@ -9,7 +9,7 @@
},
"keywords": [],
"dependencies": {
"whatsapp-web.js": "1.18.4",
"whatsapp-web.js": "1.19.2",
"@bot-whatsapp/bot": "latest",
"@bot-whatsapp/cli": "latest",
"@bot-whatsapp/database": "latest",