npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@germansan2002/mysql-generator

v1.0.0

Published

A CLI tool for generating MySQL connection and entity files

Downloads

3

Readme

Aquí tienes el archivo readme.md actualizado para incluir la información sobre cómo agregar los comandos disponibles al package.json del proyecto que importa el paquete:

# mysql-generator

`mysql-generator` es una herramienta CLI para generar archivos de conexión y modelos para trabajar con bases de datos MySQL en proyectos Node.js.

## Comandos disponibles

```bash
Comandos disponibles:
  connect         Conecta a un proveedor de base de datos y prueba la conexión.
  tables          Obtiene la lista de tablas de una base de datos determinada.
  generate, g     Genera archivos necesarios para realizar transacciones con la base de datos:
                  --connection Genera el archivo de conexión.
                  --entities    Genera los modelos basados en las tablas de la base de datos.
  stats           Obtiene estadísticas sobre el sistema operativo subyacente y la utilización de recursos:
                  --db        Obtiene datos estadísticos de la base de datos definida en el archivo de configuración.
  help            Muestra los comandos disponibles de la CLI.

Instalación

Para instalar el paquete, usa el siguiente comando:

npm install mysql-generator

Uso

Archivo de configuración

Para utilizar los comandos, debes proporcionar un archivo de configuración .json utilizando el atributo --config. Aquí tienes un ejemplo de archivo de configuración:

{
    "server": "localhost",
    "port": 3306,
    "user": {
      "name": "root",
      "password": "123456789"
    },
    "database": "examenfinal2023",
    "dest": "src/server/mysql"
}

Ejemplos de comandos

Conectar a una base de datos

mysql-generator connect --config ./path/to/config.json

Obtener la lista de tablas

mysql-generator tables --config ./path/to/config.json

Generar archivos

mysql-generator generate --connection --config ./path/to/config.json
mysql-generator generate --entities --config ./path/to/config.json

Obtener estadísticas del sistema

mysql-generator stats --config ./path/to/config.json
mysql-generator stats --db --config ./path/to/config.json

Mostrar la ayuda

mysql-generator help

Agregar comandos al package.json

Puedes agregar los comandos disponibles al package.json de tu proyecto para facilitar su uso. Aquí tienes un ejemplo de cómo hacerlo:

{
  "scripts": {
    "connect": "mysql-generator connect --config ./path/to/config.json",
    "tables": "mysql-generator tables --config ./path/to/config.json",
    "generate:connection": "mysql-generator generate --connection --config ./path/to/config.json",
    "generate:entities": "mysql-generator generate --entities --config ./path/to/config.json",
    "stats": "mysql-generator stats --config ./path/to/config.json",
    "stats:db": "mysql-generator stats --db --config ./path/to/config.json",
    "help": "mysql-generator help"
  }
}

Ahora puedes ejecutar los comandos directamente desde npm:

npm run connect
npm run tables
npm run generate:connection
npm run generate:entities
npm run stats
npm run stats:db
npm run help

Dependencias

Este proyecto utiliza las siguientes dependencias:

Contribuir

Si deseas contribuir al proyecto, por favor abre un issue o envía un pull request en el repositorio de GitHub.

Licencia

Este proyecto está bajo la licencia MIT.


Este archivo `readme.md` proporciona una guía completa sobre cómo usar el paquete, incluyendo la adición de los comandos al `package.json` del proyecto que lo importa.