mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 20:49:15 +00:00
ci(provider): ✨ automatic updated versions
This commit is contained in:
50
.github/workflows/check-providers.yml
vendored
Normal file
50
.github/workflows/check-providers.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Build and Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-npm:
|
||||||
|
name: Install Dependencies
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- test-unit
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- 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 baileys
|
||||||
|
|
||||||
|
- name: Check Venom
|
||||||
|
run: yarn node ./scripts/checker.js venom
|
||||||
|
|
||||||
|
- name: Check web-whatsapp
|
||||||
|
run: yarn node ./scripts/checker.js web-whatsapp
|
||||||
|
|
||||||
|
- name: Check Meta
|
||||||
|
run: yarn node ./scripts/checker.js meta
|
||||||
|
|
||||||
|
- name: Check Twilio
|
||||||
|
run: yarn node ./scripts/checker.js twilio
|
||||||
|
|
||||||
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: "ci(providers): updated versions providers"
|
||||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: 🤪 Build and Test
|
name: Build and Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
2
.github/workflows/contributors.yml
vendored
2
.github/workflows/contributors.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: 🙌 Revisando Colaboradores
|
name: Revisando Colaboradores
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const startInteractive = async () => {
|
|||||||
choices: [
|
choices: [
|
||||||
{ title: 'whatsapp-web.js (gratis)', value: 'wweb' },
|
{ title: 'whatsapp-web.js (gratis)', value: 'wweb' },
|
||||||
{ title: 'Venom (gratis)', value: 'venom' },
|
{ title: 'Venom (gratis)', value: 'venom' },
|
||||||
{ title: 'Baileys (gratis)', value: 'bailey' },
|
{ title: 'Baileys (gratis)', value: 'baileys' },
|
||||||
{ title: 'Twilio', value: 'twilio' },
|
{ title: 'Twilio', value: 'twilio' },
|
||||||
{ title: 'API Oficial (Meta)', value: 'meta' },
|
{ title: 'API Oficial (Meta)', value: 'meta' },
|
||||||
],
|
],
|
||||||
|
|||||||
7
packages/provider/src/baileys/package.json
Normal file
7
packages/provider/src/baileys/package.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"@adiwajshing/baileys": "5.0.0",
|
||||||
|
"mime-types": "2.1.35",
|
||||||
|
"wa-sticker-formatter": "4.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
3
packages/provider/src/meta/package.json
Normal file
3
packages/provider/src/meta/package.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
||||||
5
packages/provider/src/twilio/package.json
Normal file
5
packages/provider/src/twilio/package.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"twilio": "3.84.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
packages/provider/src/venom/package.json
Normal file
6
packages/provider/src/venom/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"venom-bot": "4.3.7",
|
||||||
|
"mime-types": "2.1.35"
|
||||||
|
}
|
||||||
|
}
|
||||||
5
packages/provider/src/web-whatsapp/package.json
Normal file
5
packages/provider/src/web-whatsapp/package.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "1.18.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
131
scripts/checker.js
Normal file
131
scripts/checker.js
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
const { execFile } = require('node:child_process')
|
||||||
|
const { readFileSync, writeFileSync, readdirSync } = require('node:fs')
|
||||||
|
const { join } = require('path')
|
||||||
|
const process = require('node:process')
|
||||||
|
const util = require('node:util')
|
||||||
|
const semver = require('semver')
|
||||||
|
|
||||||
|
const cmd = util.promisify(execFile)
|
||||||
|
const OS_ENVIROMENT_WIN = process.platform.includes('win32')
|
||||||
|
|
||||||
|
const PATH_PACKAGES = join(__dirname, '..', `packages`)
|
||||||
|
const PATH_STARTERS = join(__dirname, '..', `starters`, `apps`)
|
||||||
|
const NPM_COMMAND = OS_ENVIROMENT_WIN ? 'npm.cmd' : 'npm'
|
||||||
|
const [PKG_NAME] = process.argv.slice(2) || [null]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Revisar ultima version de una paquetes
|
||||||
|
* @param {*} pkgName
|
||||||
|
*/
|
||||||
|
const checkPkg = async (pkgName = '') => {
|
||||||
|
const { stdout } = await cmd(
|
||||||
|
NPM_COMMAND,
|
||||||
|
['show', `${pkgName}`, 'version'],
|
||||||
|
{
|
||||||
|
stdio: 'inherit',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return stdout.trim().replace('\n', '')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Revisar todas las dependencias del provider
|
||||||
|
* @param {*} provider
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const checkEveryProvider = async (provider = '') => {
|
||||||
|
const pkgDependencies = readFileSync(
|
||||||
|
join(PATH_PACKAGES, 'provider', 'src', provider, 'package.json')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
const { dependencies } = JSON.parse(pkgDependencies)
|
||||||
|
const devParse = Object.entries(dependencies)
|
||||||
|
const newDevParse = {}
|
||||||
|
for (const [pkgName] of devParse) {
|
||||||
|
const lastVersion = await checkPkg(pkgName)
|
||||||
|
newDevParse[pkgName] = lastVersion
|
||||||
|
}
|
||||||
|
return newDevParse
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualizar depedencias con nuevas versiones
|
||||||
|
* @param {*} provider
|
||||||
|
* @param {*} list
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const updateDependencies = async (provider = '', list = {}) => {
|
||||||
|
const pathProvider = join(
|
||||||
|
PATH_PACKAGES,
|
||||||
|
'provider',
|
||||||
|
'src',
|
||||||
|
provider,
|
||||||
|
'package.json'
|
||||||
|
)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const pkgDependencies = readFileSync(pathProvider)
|
||||||
|
const { dependencies } = JSON.parse(pkgDependencies)
|
||||||
|
writeFileSync(
|
||||||
|
pathProvider,
|
||||||
|
JSON.stringify(
|
||||||
|
{ dependencies: { ...dependencies, ...list } },
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualizar starters
|
||||||
|
* @param {*} provider
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const updateStarters = async (provider = '', updateDev = {}) => {
|
||||||
|
provider = provider === 'web-whatsapp' ? 'wweb' : provider
|
||||||
|
const allStarters = readdirSync(PATH_STARTERS).filter((n) =>
|
||||||
|
n.includes(provider)
|
||||||
|
)
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (const base of allStarters) {
|
||||||
|
const pkgDependenciesBase = readFileSync(
|
||||||
|
join(PATH_STARTERS, base, 'package.json')
|
||||||
|
)
|
||||||
|
const pkgBase = JSON.parse(pkgDependenciesBase)
|
||||||
|
writeFileSync(
|
||||||
|
join(PATH_STARTERS, base, 'package.json'),
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
...pkgBase,
|
||||||
|
dependencies: { ...pkgBase.dependencies, ...updateDev },
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
if (PKG_NAME) {
|
||||||
|
const list = await checkEveryProvider(PKG_NAME)
|
||||||
|
await updateDependencies(PKG_NAME, list)
|
||||||
|
await updateStarters(PKG_NAME, list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib base-bailey-memory",
|
"pre-copy": "cd .. && yarn run copy.lib base-baileys-memory",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
"@adiwajshing/baileys": "^4.4.0",
|
"@adiwajshing/baileys": "5.0.0",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"wa-sticker-formatter": "^4.3.2"
|
"wa-sticker-formatter": "4.3.2"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib base-bailey-mongo",
|
"pre-copy": "cd .. && yarn run copy.lib base-baileys-mongo",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
"@adiwajshing/baileys": "^4.4.0",
|
"@adiwajshing/baileys": "5.0.0",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"mongodb": "^4.12.1",
|
"mongodb": "^4.12.1",
|
||||||
"wa-sticker-formatter": "^4.3.2"
|
"wa-sticker-formatter": "4.3.2"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib base-bailey-mysql",
|
"pre-copy": "cd .. && yarn run copy.lib base-baileys-mysql",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
"@adiwajshing/baileys": "^4.4.0",
|
"@adiwajshing/baileys": "5.0.0",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"mysql2": "^2.3.3",
|
"mysql2": "^2.3.3",
|
||||||
"wa-sticker-formatter": "^4.3.2"
|
"wa-sticker-formatter": "4.3.2"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.1",
|
"body-parser": "^1.20.1",
|
||||||
"polka": "^0.5.2",
|
"polka": "^0.5.2",
|
||||||
"twilio": "^3.83.4",
|
"twilio": "3.84.0",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.1",
|
"body-parser": "^1.20.1",
|
||||||
"polka": "^0.5.2",
|
"polka": "^0.5.2",
|
||||||
"twilio": "^3.83.4",
|
"twilio": "3.84.0",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.20.1",
|
"body-parser": "^1.20.1",
|
||||||
"polka": "^0.5.2",
|
"polka": "^0.5.2",
|
||||||
"twilio": "^3.83.4",
|
"twilio": "3.84.0",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
|
|||||||
@@ -9,11 +9,12 @@
|
|||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"venom-bot": "^4.3.7",
|
"venom-bot": "4.3.7",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest"
|
"@bot-whatsapp/provider": "latest",
|
||||||
|
"mime-types": "2.1.35"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"venom-bot": "^4.3.7",
|
"venom-bot": "4.3.7",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"mongodb": "^4.12.1"
|
"mongodb": "^4.12.1"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|||||||
@@ -9,12 +9,13 @@
|
|||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"venom-bot": "^4.3.7",
|
"venom-bot": "4.3.7",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest",
|
"@bot-whatsapp/provider": "latest",
|
||||||
"mysql2": "^2.3.3"
|
"mysql2": "^2.3.3",
|
||||||
|
"mime-types": "2.1.35"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatsapp-web.js": "^1.18.4",
|
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
"@bot-whatsapp/provider": "latest"
|
"@bot-whatsapp/provider": "latest",
|
||||||
|
"whatsapp-web.js": "1.18.4"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatsapp-web.js": "^1.18.4",
|
"whatsapp-web.js": "1.18.4",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatsapp-web.js": "^1.18.4",
|
"whatsapp-web.js": "1.18.4",
|
||||||
"@bot-whatsapp/bot": "latest",
|
"@bot-whatsapp/bot": "latest",
|
||||||
"@bot-whatsapp/cli": "latest",
|
"@bot-whatsapp/cli": "latest",
|
||||||
"@bot-whatsapp/database": "latest",
|
"@bot-whatsapp/database": "latest",
|
||||||
|
|||||||
Reference in New Issue
Block a user