mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 12:39:24 +00:00
Merge branch 'dev' into fix/create-script
This commit is contained in:
9
.github/FUNDING.yml
vendored
Normal file
9
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: #
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
custom: https://www.buymeacoffee.com/leifermendez
|
||||||
46
.github/workflows/ci.yml
vendored
46
.github/workflows/ci.yml
vendored
@@ -1,12 +1,8 @@
|
|||||||
name: BotWhatsapp CI
|
name: BotWhatsapp Build-Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
|
||||||
- dev
|
- dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -38,46 +34,6 @@ jobs:
|
|||||||
- name: Build Eslint rules
|
- name: Build Eslint rules
|
||||||
run: yarn lint:fix
|
run: yarn lint:fix
|
||||||
|
|
||||||
############ RELEASE ############
|
|
||||||
release:
|
|
||||||
name: Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- build-package
|
|
||||||
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: Build Package
|
|
||||||
run: yarn build
|
|
||||||
|
|
||||||
- name: Release @bot-whatsapp/bot
|
|
||||||
run: yarn node ./scripts/release.js --name=bot --version= --token="${{ secrets.NPM_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Release @bot-whatsapp/cli
|
|
||||||
run: yarn node ./scripts/release.js --name=cli --version= --token="${{ secrets.NPM_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Release @bot-whatsapp/create-bot-whatsapp
|
|
||||||
run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version= --token="${{ secrets.NPM_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Release @bot-whatsapp/database
|
|
||||||
run: yarn node ./scripts/release.js --name=database --version= --token="${{ secrets.NPM_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Release @bot-whatsapp/provider
|
|
||||||
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
|
|
||||||
|
|
||||||
############ UNIT TEST ############
|
############ UNIT TEST ############
|
||||||
test-unit:
|
test-unit:
|
||||||
name: Unit Tests
|
name: Unit Tests
|
||||||
|
|||||||
56
.github/workflows/releases.yml
vendored
Normal file
56
.github/workflows/releases.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: BotWhatsapp Releases
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- next-release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
############ RELEASE ############
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
persist-credentials: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- 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: Build Package
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/bot
|
||||||
|
run: yarn node ./scripts/release.js --name=bot --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/cli
|
||||||
|
run: yarn node ./scripts/release.js --name=cli --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/create-bot-whatsapp
|
||||||
|
run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/database
|
||||||
|
run: yarn node ./scripts/release.js --name=database --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/provider
|
||||||
|
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Commit Versioning & Push changes
|
||||||
|
uses: actions-js/push@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
message: 'ci(version): :zap: automatic - ${date} updated versions every packages'
|
||||||
|
branch: 'dev'
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/packages/create-bot-whatsapp/starters
|
/packages/*/starters
|
||||||
/packages/*/node_modules
|
/packages/*/node_modules
|
||||||
/packages/*/dist
|
/packages/*/dist
|
||||||
/packages/*/docs/dist
|
/packages/*/docs/dist
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
||||||
Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||||
|
|
||||||
- [ ] Evitar dependencias
|
🚀 __Roadmap:__ [https://github.com/users/leifermendez/projects/4/views/1](https://github.com/users/leifermendez/projects/4/views/1)
|
||||||
|
|
||||||
|
|
||||||
**Comunidad**
|
**Comunidad**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/bot",
|
"name": "@bot-whatsapp/bot",
|
||||||
"version": "0.0.4-alpha.0",
|
"version": "0.0.18-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.bot.cjs",
|
"main": "./lib/bundle.bot.cjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ const copyFiles = async (from, to) => {
|
|||||||
* Copiar directorio con archivos
|
* Copiar directorio con archivos
|
||||||
* @param {*} templateName
|
* @param {*} templateName
|
||||||
*/
|
*/
|
||||||
const copyBaseApp = async (templateName = null) => {
|
const copyBaseApp = async (fromDir = process.cwd(), toDir = process.cwd()) => {
|
||||||
const BASEP_APP_PATH_FROM = `${process.cwd()}/starters/apps/${templateName}`
|
const BASEP_APP_PATH_FROM = `${fromDir}`
|
||||||
const BASEP_APP_PATH_TO = `${process.cwd()}/${templateName}`
|
const BASEP_APP_PATH_TO = `${toDir}`
|
||||||
await copyFiles(BASEP_APP_PATH_FROM, BASEP_APP_PATH_TO)
|
await copyFiles(BASEP_APP_PATH_FROM, BASEP_APP_PATH_TO)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
const prompts = require('prompts')
|
const prompts = require('prompts')
|
||||||
const { yellow, red } = require('kleur')
|
const { yellow, red, cyan } = require('kleur')
|
||||||
const { copyBaseApp } = require('../create-app')
|
const { copyBaseApp } = require('../create-app')
|
||||||
|
const { join } = require('path')
|
||||||
|
const { existsSync } = require('fs')
|
||||||
const { checkNodeVersion, checkOs } = require('../check')
|
const { checkNodeVersion, checkOs } = require('../check')
|
||||||
|
|
||||||
|
const bannerDone = () => {
|
||||||
|
console.log(``)
|
||||||
|
console.log(
|
||||||
|
cyan(
|
||||||
|
[
|
||||||
|
`[Agradecimientos]: Este es un proyecto OpenSource, si tienes intenciones de colaborar puedes hacerlo:`,
|
||||||
|
`[😉] Comprando un cafe https://www.buymeacoffee.com/leifermendez`,
|
||||||
|
`[⭐] Dar estrella https://github.com/leifermendez/bot-whatsapp`,
|
||||||
|
`[🚀] Realizando mejoras en el codigo`,
|
||||||
|
].join('\n')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
console.log(``)
|
||||||
|
}
|
||||||
|
|
||||||
const startInteractive = async () => {
|
const startInteractive = async () => {
|
||||||
const questions = [
|
const questions = [
|
||||||
{
|
{
|
||||||
@@ -49,48 +66,29 @@ const startInteractive = async () => {
|
|||||||
}
|
}
|
||||||
const response = await prompts(questions, { onCancel })
|
const response = await prompts(questions, { onCancel })
|
||||||
const { outDir = '', providerDb = [], providerWs = [] } = response
|
const { outDir = '', providerDb = [], providerWs = [] } = response
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Question
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
// const installOrUdpateDep = async () => {
|
|
||||||
// const answer = dependencies.toLowerCase() || 'n'
|
|
||||||
// if (answer.includes('n')) return true
|
|
||||||
|
|
||||||
// if (answer.includes('y')) {
|
|
||||||
// await installAll()
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Question
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
// const cleanAllSession = async () => {
|
|
||||||
// const answer = cleanTmp.toLowerCase() || 'n'
|
|
||||||
// if (answer.includes('n')) return true
|
|
||||||
|
|
||||||
// if (answer.includes('y')) {
|
|
||||||
// await cleanSession()
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Crear una app (copiar plantilla)
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
const createApp = async (templateName = null) => {
|
const createApp = async (templateName = null) => {
|
||||||
if (!templateName)
|
if (!templateName)
|
||||||
throw new Error('TEMPLATE_NAME_INVALID: ', templateName)
|
throw new Error('TEMPLATE_NAME_INVALID: ', templateName)
|
||||||
|
|
||||||
|
const possiblesPath = [
|
||||||
|
join(__dirname, 'starters', 'apps', templateName),
|
||||||
|
join(__dirname, '..', 'starters', 'apps', templateName),
|
||||||
|
join(__dirname, '..', '..', 'starters', 'apps', templateName),
|
||||||
|
]
|
||||||
|
|
||||||
const answer = outDir.toLowerCase() || 'n'
|
const answer = outDir.toLowerCase() || 'n'
|
||||||
if (answer.includes('n')) return true
|
if (answer.includes('n')) return true
|
||||||
|
|
||||||
if (answer.includes('y')) {
|
if (answer.includes('y')) {
|
||||||
await copyBaseApp(templateName)
|
const indexOfPath = possiblesPath.find((a) => existsSync(a))
|
||||||
|
await copyBaseApp(indexOfPath, join(process.cwd(), templateName))
|
||||||
|
console.log(``)
|
||||||
|
console.log(yellow(`cd ${templateName}`))
|
||||||
|
console.log(yellow(`npm install`))
|
||||||
|
console.log(yellow(`npm start`))
|
||||||
|
console.log(``)
|
||||||
|
|
||||||
return outDir
|
return outDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +107,6 @@ const startInteractive = async () => {
|
|||||||
)
|
)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
console.log(yellow(`'Deberia crer una carpeta en root/provider'`))
|
|
||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +131,7 @@ const startInteractive = async () => {
|
|||||||
const dbAdapter = await dbProvider()
|
const dbAdapter = await dbProvider()
|
||||||
const NAME_DIR = ['base', providerAdapter, dbAdapter].join('-')
|
const NAME_DIR = ['base', providerAdapter, dbAdapter].join('-')
|
||||||
await createApp(NAME_DIR)
|
await createApp(NAME_DIR)
|
||||||
|
bannerDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { startInteractive }
|
module.exports = { startInteractive }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/cli",
|
"name": "@bot-whatsapp/cli",
|
||||||
"version": "0.0.4-alpha.0",
|
"version": "0.0.25-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"kleur": "^4.1.5"
|
"kleur": "^4.1.5"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"./starters/",
|
||||||
"./lib/cli/bundle.cli.cjs"
|
"./lib/cli/bundle.cli.cjs"
|
||||||
],
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const banner = require('../../config/banner.rollup.json')
|
const banner = require('../../config/banner.rollup.json')
|
||||||
const commonjs = require('@rollup/plugin-commonjs')
|
const commonjs = require('@rollup/plugin-commonjs')
|
||||||
|
const copy = require('rollup-plugin-copy')
|
||||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
|
|
||||||
@@ -12,5 +13,11 @@ module.exports = {
|
|||||||
file: PATH,
|
file: PATH,
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
},
|
},
|
||||||
plugins: [commonjs(), nodeResolve()],
|
plugins: [
|
||||||
|
copy({
|
||||||
|
targets: [{ src: 'starters/*', dest: join(__dirname, 'starters') }],
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
nodeResolve(),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
0
packages/create-bot-whatsapp/bin/create.js
Normal file → Executable file
0
packages/create-bot-whatsapp/bin/create.js
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-bot-whatsapp",
|
"name": "create-bot-whatsapp",
|
||||||
"version": "0.0.13-alpha.0",
|
"version": "0.0.31-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const banner = require('../../config/banner.rollup.json')
|
const banner = require('../../config/banner.rollup.json')
|
||||||
const commonjs = require('@rollup/plugin-commonjs')
|
const commonjs = require('@rollup/plugin-commonjs')
|
||||||
const copy = require('rollup-plugin-copy')
|
|
||||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
|
|
||||||
@@ -13,11 +13,5 @@ module.exports = {
|
|||||||
file: PATH,
|
file: PATH,
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [commonjs(), nodeResolve()],
|
||||||
copy({
|
|
||||||
targets: [{ src: 'starters/*', dest: join(__dirname, 'starters') }],
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
nodeResolve(),
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/database",
|
"name": "@bot-whatsapp/database",
|
||||||
"version": "0.0.4-alpha.0",
|
"version": "0.0.17-alpha.0",
|
||||||
"description": "Esto es el conector a mysql, pg, mongo",
|
"description": "Esto es el conector a mysql, pg, mongo",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/provider",
|
"name": "@bot-whatsapp/provider",
|
||||||
"version": "0.0.10-alpha.0",
|
"version": "0.0.23-alpha.0",
|
||||||
"description": "Esto es el conector a Twilio, Meta, etc...",
|
"description": "Esto es el conector a Twilio, Meta, etc...",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -82,6 +82,35 @@ const updateVersion = async (packageName = null, number = null) => {
|
|||||||
return { version: newVersion }
|
return { version: newVersion }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Revisar si la version nueva existe o no en npmjs
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} version
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const checkExistVersion = async (packageName = null, version = null) => {
|
||||||
|
try {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const pkgJsonObject = readPackage(packageName)
|
||||||
|
const { stdout } = await cmd(
|
||||||
|
NPM_COMMAND,
|
||||||
|
['view', `${pkgJsonObject.name}@${version}`],
|
||||||
|
{
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empaquetar
|
||||||
|
* @param {*} packageName
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
const packRelease = async (packageName) => {
|
const packRelease = async (packageName) => {
|
||||||
const pkgJson = join(PATH_PACKAGES, packageName)
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
||||||
@@ -91,6 +120,12 @@ const packRelease = async (packageName) => {
|
|||||||
return stdout
|
return stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lanzar release
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} latest
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
const publishRelease = async (packageName, latest = null) => {
|
const publishRelease = async (packageName, latest = null) => {
|
||||||
const args = !latest ? ['--tag', 'dev'] : ['--access', 'public']
|
const args = !latest ? ['--tag', 'dev'] : ['--access', 'public']
|
||||||
const pkgJson = join(PATH_PACKAGES, packageName)
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
@@ -106,15 +141,24 @@ const publishRelease = async (packageName, latest = null) => {
|
|||||||
* Recibe los argumentos entrantes
|
* Recibe los argumentos entrantes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init
|
||||||
|
*/
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
if (PKG_ARG) {
|
if (PKG_ARG) {
|
||||||
|
let EXIST_VERSION = true
|
||||||
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
||||||
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
||||||
const pkgNumber = PKG_ARG_VERSION
|
const pkgNumber = PKG_ARG_VERSION
|
||||||
? PKG_ARG_VERSION.split('=').at(1)
|
? PKG_ARG_VERSION.split('=').at(1)
|
||||||
: null
|
: null
|
||||||
if (tokenNpm) await npmToken(tokenNpm)
|
if (tokenNpm) await npmToken(tokenNpm)
|
||||||
await updateVersion(pkgName, pkgNumber)
|
|
||||||
|
while (EXIST_VERSION) {
|
||||||
|
const { version } = await updateVersion(pkgName, pkgNumber)
|
||||||
|
EXIST_VERSION = await checkExistVersion(pkgName, version)
|
||||||
|
console.log(`[${pkgName} - Version]: `, version, EXIST_VERSION)
|
||||||
|
}
|
||||||
await packRelease(pkgName)
|
await packRelease(pkgName)
|
||||||
await publishRelease(pkgName, pkgNumber)
|
await publishRelease(pkgName, pkgNumber)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
"pre-copy": "cd .. && yarn run copy.lib base-twilio-memory",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
"pre-copy": "cd .. && yarn run copy.lib base-twilio-mongo",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
"pre-copy": "cd .. && yarn run copy.lib base-twilio-mysql",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
"pre-copy": "cd .. && yarn run copy.lib base-wweb-memory",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
"pre-copy": "cd .. && yarn run copy.lib base-wweb-mongo",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
"pre-copy": "cd .. && yarn run copy.lib base-wweb-mysql",
|
||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
### BASE APP
|
|
||||||
|
|
||||||
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
|
||||||
- Bienvenido a mi tienda
|
|
||||||
- Como puedo ayudarte?
|
|
||||||
- Tengo: Zapatos Bolsos etc..
|
|
||||||
|
|
||||||
------
|
|
||||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
|
||||||
- [Twitter](https://twitter.com/leifermendez)
|
|
||||||
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
|
||||||
- [Telegram](https://t.me/leifermendez)
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
const {
|
|
||||||
createBot,
|
|
||||||
createProvider,
|
|
||||||
createFlow,
|
|
||||||
addKeyword,
|
|
||||||
} = require('@bot-whatsapp/bot')
|
|
||||||
|
|
||||||
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
|
||||||
const MockAdapter = require('@bot-whatsapp/database/mock')
|
|
||||||
|
|
||||||
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
|
||||||
.addAnswer('Bienvenido a mi tienda')
|
|
||||||
.addAnswer('Como puedo ayudarte?')
|
|
||||||
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
|
||||||
|
|
||||||
const main = async () => {
|
|
||||||
const adapterDB = new MockAdapter()
|
|
||||||
const adapterFlow = createFlow([flowPrincipal])
|
|
||||||
const adapterProvider = createProvider(WebWhatsappProvider)
|
|
||||||
|
|
||||||
createBot({
|
|
||||||
flow: adapterFlow,
|
|
||||||
provider: adapterProvider,
|
|
||||||
database: adapterDB,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "bot-whatsapp-base",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "app.js",
|
|
||||||
"scripts": {
|
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
|
||||||
"start": "node app.js"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"dependencies": {
|
|
||||||
"whatsapp-web.js": "^1.18.3"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC"
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
### BASIC APP
|
|
||||||
|
|
||||||
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
|
||||||
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
------
|
|
||||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
|
||||||
- [Twitter](https://twitter.com/leifermendez)
|
|
||||||
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
|
||||||
- [Telegram](https://t.me/leifermendez)
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
const {
|
|
||||||
createBot,
|
|
||||||
createProvider,
|
|
||||||
createFlow,
|
|
||||||
addKeyword,
|
|
||||||
addChild,
|
|
||||||
} = require('@bot-whatsapp/bot')
|
|
||||||
|
|
||||||
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
|
||||||
const MockAdapter = require('@bot-whatsapp/database/mock')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Declarando flujo hijo
|
|
||||||
*/
|
|
||||||
|
|
||||||
const flowZapatos = addKeyword(['zapatos', 'ZAPATOS'])
|
|
||||||
.addAnswer('🤯 Veo que elegiste zapatos')
|
|
||||||
.addAnswer('Tengo muchos zapatos...bla bla')
|
|
||||||
|
|
||||||
const flowBolsos = addKeyword(['bolsos', 'BOLSOS'])
|
|
||||||
.addAnswer('🙌 Veo que elegiste bolsos')
|
|
||||||
.addAnswer('Tengo muchos bolsos...bla bla')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Declarando flujo principal
|
|
||||||
*/
|
|
||||||
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
|
||||||
.addAnswer('Bienvenido a mi tienda')
|
|
||||||
.addAnswer('Como puedo ayudarte?')
|
|
||||||
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
|
||||||
.addAnswer('Escribe zapatos o bolsos')
|
|
||||||
.addAnswer(
|
|
||||||
'esperando respuesta...',
|
|
||||||
{ capture: true },
|
|
||||||
(ctx) => {
|
|
||||||
console.log('Aqui puedes ver más info del usuario...')
|
|
||||||
console.log('Puedes enviar un mail, hook, etc..')
|
|
||||||
console.log(ctx)
|
|
||||||
},
|
|
||||||
[...addChild(flowBolsos), ...addChild(flowZapatos)]
|
|
||||||
)
|
|
||||||
|
|
||||||
const main = async () => {
|
|
||||||
const adapterDB = new MockAdapter()
|
|
||||||
const adapterFlow = createFlow([flowPrincipal])
|
|
||||||
const adapterProvider = createProvider(WebWhatsappProvider)
|
|
||||||
|
|
||||||
createBot({
|
|
||||||
flow: adapterFlow,
|
|
||||||
provider: adapterProvider,
|
|
||||||
database: adapterDB,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "bot-whatsapp-basic",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "app.js",
|
|
||||||
"scripts": {
|
|
||||||
"pre-copy": "cd .. && yarn run copy.lib example-app-basic",
|
|
||||||
"start": "node app.js"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"dependencies": {
|
|
||||||
"whatsapp-web.js": "^1.18.3"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user