Skip to content

Commit

Permalink
fix(cli): 🔥 create script - templates
Browse files Browse the repository at this point in the history
  • Loading branch information
leifermendez committed Dec 10, 2022
2 parents eebc3c9 + 257f1cc commit d4b49a9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
23 changes: 12 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

__Requerimientos:__
- Node v16 o superior __[descargar node](https://nodejs.org/es/download/)__
- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguiras las intrucciones para instalar yarn.
- __[VSCode](https://code.visualstudio.com/download)__ (recomendado): Editor de codigo con plugins
- __[Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits&ssr=false#overview)__ (plugin-vscode) este plugin te ayudara a crear commit semantico.
- Se usara la rama __dev__ *(https://github.com/leifermendez/bot-whatsapp/tree/dev)* como rama principal hasta que se haga oficialmente el lanzamiento de la V2
- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguirás las intrucciones para instalar yarn.
- __[VSCode](https://code.visualstudio.com/download)__ (recomendado): Editor de código con plugins.
- __[Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits&ssr=false#overview)__ (plugin-vscode) este plugin te ayudará a crear commit semántico.
- Se usará la rama __dev__ *(https://github.com/leifermendez/bot-whatsapp/tree/dev)* como rama principal hasta que se haga oficialmente el lanzamiento de la V2.

### 🚀 Iniciando

Expand All @@ -22,14 +22,14 @@ yarn install
```

__Compilar (build)__
Para compilar la aplicación es necesario ejecutar, eso te genera dentro de packages del monorepo un directorio `lib`
Para compilar la aplicación es necesario ejecutar este comando, el cual genera un directorio `lib` dentro de los paquetes del monorepo.

```
yarn build
```

__Example-app__
Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de ejemplo
Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de ejemplo.
```
yarn run cli
```
Expand All @@ -42,15 +42,16 @@ npm run pre-copy
npm start
```

__Commit y Push__
El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__ es una herramienta que dispara unas acciones al momento de hacer commit y hacer push
### __Commit y Push__

__commit:__ Los commit son semanticos esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__
El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__, es una herramienta que dispara unas acciones al momento de hacer commit y hacer push.

__push:__ Cada push ejecutar `yarn run test` el cual ejecuta los test internos que tienen que cumplir con __95% de cobertura__.
__commit:__ Los commit son semánticos, esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo: ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__

__push:__ Cada push ejecutar `yarn run test` el cual realiza los test internos que tienen que cumplir con __95% de cobertura__.

> Documento en constaten actualización....

> Documento en constante actualización....
------
- [Discord](https://link.codigoencasa.com/DISCORD)
Expand Down
6 changes: 3 additions & 3 deletions packages/bot/core/core.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ class CoreClass {
listenerBusEvents = () => [
{
event: 'preinit',
func: () => printer('Iniciando provider espere...'),
func: () => printer('Iniciando proveedor, espere...'),
},
{
event: 'require_action',
func: ({ instructions, title = '⚡⚡ ACCION REQUERIDA ⚡⚡' }) =>
func: ({ instructions, title = '⚡⚡ ACCIÓN REQUERIDA ⚡⚡' }) =>
printer(instructions, title),
},
{
event: 'ready',
func: () => printer('Provider conectado y listo'),
func: () => printer('Proveedor conectado y listo'),
},
{
event: 'auth_failure',
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/check/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ const checkNodeVersion = () => {
)
process.exit(1)
}
console.log(green(`Node.js combatible ${version}`))
console.log(green(`Node.js compatible ${version}`))
console.log(``)
}

const checkOs = () => {
console.log(bgCyan('🙂 Revisando tu Sistema Operativo'))
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 confiuración adicional referente al puppeter`,
`una configuración adicional referente al puppeteer`,
``,
`Recuerda pasar por el WIKI`,
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalaci%C3%B3n`,
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`,
``,
]

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/install/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getPkgManage = async () => {
}

const installDeps = (pkgManager, packageList) => {
const errorMessage = `Ocurrio un error instalando ${packageList}`
const errorMessage = `Ocurrió un error instalando ${packageList}`
let childProcess = []

const installSingle = (pkgInstall) => () => {
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/interactive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ const startInteractive = async () => {
{
type: 'multiselect',
name: 'providerWs',
message: 'Proveedor de Whatsapp',
message: '¿Cuál proveedor de whatsapp quieres utilizar?',
choices: [
{ title: 'whatsapp-web.js (gratis)', value: 'wweb' },
{ title: 'Twilio', value: 'twilio' },
{ title: 'Baileys (gratis)', value: 'bailey', disabled: true },
{ title: 'API Oficial (Meta)', value: 'meta', disabled: true },
],
max: 1,
hint: 'Espacio para selecionar',
hint: 'Espacio para seleccionar',
instructions: '↑/↓',
},
{
type: 'multiselect',
name: 'providerDb',
message: 'Cual base de datos quieres usar',
message: '¿Cuál base de datos quieres utilizar?',
choices: [
{ title: 'Memory', value: 'memory' },
{ title: 'Mongo', value: 'mongo' },
{ title: 'MySQL', value: 'mysql' },
{ title: 'Json', value: 'json', disabled: true },
],
max: 1,
hint: 'Espacio para selecionar',
hint: 'Espacio para seleccionar',
instructions: '↑/↓',
},
]
Expand All @@ -47,7 +47,7 @@ const startInteractive = async () => {
checkNodeVersion()
checkOs()
const onCancel = () => {
console.log('Proceso cancelado!')
console.log('¡Proceso cancelado!')
return true
}
const response = await prompts(questions, { onCancel })
Expand Down Expand Up @@ -113,7 +113,7 @@ const startInteractive = async () => {
if (!providerWs.length) {
console.log(
red(
`Debes de seleccionar una WS Provider. Tecla [Space] para seleccionar`
`Debes seleccionar un proveedor de whatsapp. Tecla [Space] para seleccionar`
)
)
process.exit(1)
Expand All @@ -131,7 +131,7 @@ const startInteractive = async () => {
if (!providerDb.length) {
console.log(
red(
`Debes de seleccionar una DB Provider. Tecla [Space] para seleccionar`
`Debes seleccionar un proveedor de base de datos. Tecla [Space] para seleccionar`
)
)
process.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/move.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Promise.all([
copyLibPkg('bot', appDir),
copyLibPkg('database', appDir),
copyLibPkg('provider', appDir),
]).then(() => console.log('Todas las lib copiadas'))
]).then(() => console.log('Todas las librerías copiadas'))

0 comments on commit d4b49a9

Please sign in to comment.