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

tomato-fire-egg

v1.0.8

Published

this is an egg basic code generator(db's table/document CRUD) power by LeoFeng.including eggjs framework and usesfull setting.

Downloads

20

Readme

tomato-fire-egg【番茄炒蛋】

这是一个egg框架项目的脚手架。可以通过tomato-fire-egg init指令快速创建一个egg基础项目-egg基础项目git地址,创建好项目后,你可以在app/model/文件夹下创建mongoose的文档模型,然后运行本脚手架tomato-fire-egg g命令,脚手架会为你针对这个文档模型,创建增/删/改/查的CRUD通用代码(包含分页查询),可以直接跑起来[其他数据库的代码生成将陆续支持]。

命令实现情况:

  • 【√】init :快速初始化egg基础代码
  • 【√】gen :对已建好的mongoose模型model快速生成增删改查的通用代码。

说明,支持Mongodb数据库文档模型的controller和service生成,并对应配置路由route。

全局安装

npm install tomato-fire-egg -g

使用:

command

1 - 初始化egg框架代码:

tomato-fire-egg init

输入项目名称,脚手架会帮你创建项目文件夹,并自动获取上述git基础代码。

初始化完成后,请修改并确保数据库相关配置地址、账号密码是正确和有效的,或者,直接config/plugin.js文件下,禁用插件。

  • app/config/config.default.js :
//mongodb的配置,支持多连接配置 by LeoFeng 2020-5-21 13:48:53
  config.mongoose = {
    clients: {
      // clientId, access the client instance by app.mongooseDB.get('clientId')
      main: {
        url: 'mongodb://你的mongodb账号:你的mongodb密码@你的mongodb的ip:port/你的数据库名',
        options: {},
      },
    },
  };
  // MySQL, MariaDB, SQLite and Microsoft SQL Server数据库支持,by LeoFeng 2020-5-21 13:49:32
  config.sequelize = {
    dialect: 'mysql',
    host: '168.168.xx.xx',//你的数据库IP
    port: 3306,
    database: 'gac_egg_core',//你的数据库名称
    username: 'root',//你的登录名
    password: 'xxx',//你的密码
    delegate: 'sequelizeModel', //挂载到app上的model名称,此配置后可以通过app.sequelizeModel访问
    baseDir: 'model/sequelize', //由于mongoose已占用了默认的model路径,所以新增一个sequelize文件夹来存储
  };
  • app/config/config.local.js:
//redis配置 by LeoFeng 2020-5-25 10:38:30
  exports.redis = {
    client: {
      cluster: true,
      nodes: [
        {
          port: 8888,          // 你的端口
          host: '172.31.xx.xx',   // 你的ip
          password: null,
          db: 0,
          keyPrefix: 'gac-egg',
        },
        {
          port: 8888,          // Redis port
          host: '172.31.xx.xx',   // Redis host
          password: null,
          db: 0,
          keyPrefix: 'gac-egg',
        }
      ]
    },
  }
  • app/config/config.prod.js:根据你的正式发布环境进行配置即可。

2 - 生成mongodb对应CRUD的controller/service code:

tomato-fire-egg gen

或者

tomato-fire-egg g

详细步骤

  • 初始化好egg框架代码、进入项目根目录(project.json所在目录);
  • app/model/下创建你的文档模型(也就是表的model);
  • 执行tomato-fire-egg g命令,生成controllerservice代码;
  • npm run dev即可跑起来进行对文档的CRUD;[!!!确保上文提到的相关数据库地址、账号密码正确有效!!!]

具体基础代码的说明,tomato-egg-basic项目下README.md有详细的说明。查看

引用参考

commander

inquirer

pascal-case

download-git-repo