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 🙏

© 2026 – Pkg Stats / Ryan Hefner

charles-create

v1.0.8

Published

## 简介 一个创建node mvc模板和web模板的cli ## 全局安装 ``` npm install -g charles-create ``` ## 项目安装 ``` npm install --save-dev charles-create ``` ## 快速开始 ### 本地安装 package.json scripts 添加命令 ``` "create": "t-create" ``` ### 全局安装 终端运行 t-creat

Readme

安装

简介

一个创建node mvc模板和web模板的cli

全局安装

 npm install -g charles-create

项目安装

 npm install --save-dev charles-create

快速开始

本地安装

package.json scripts 添加命令

 "create": "t-create"

全局安装

终端运行
    t-create mvc {name} // 创建node mvc模板文件 
    t-create web {name} // 创建web模板文件

默认配置

mvc 文件生成路径

  • controller:app/controller/{name}.ts
  • service:app/service/{name}.ts
  • model:app/model/{name}.ts

web 文件生成路径

  • web: app/web/{name}/index.ts

配置文件

读取项目目录 create.config.js 文件,文件导出参数

const controller = require('./template/controller')
module.exports = {
  mvc: {
    controller, // controller文件个性化配置
    model,  // model文件个性化配置
    service, // service文件个性化配置
  },
  web // web文件个性化配置
};

controller 例子

// example
module.exports = function (name) {
  const upperCaseName = name.replace(name[0], name[0].toUpperCase());
  const lowerCaseName = name.replace(name[0], name[0].toLowerCase());
  const template = `
import Controller from './base';
import * as sequelize from 'sequelize';
export default class ${upperCaseName}Controller extends Controller {
  async index() {
    const { ctx, service } = this;
    const { query } = ctx;
    const pageIndex = (query.pageIndex && parseInt(query.pageIndex, 10)) || 0;
    const pageSize = (query.pageSize && parseInt(query.pageSize, 10)) || 0;
    const where = {};
    const order = [['id', 'DESC']];
    const result: any = await service.${lowerCaseName}.find({
      where,
      order,
      attributes: ['id'],
      limit: pageSize,
      offset:pageSize ? (pageIndex - 1) * pageSize : 0
    });

    this.success(result, ctx.__('FetchSuccess'));
  }
  async show() {
    const { ctx, service } = this;
    const { params } = ctx;
    const { id } = params;
    let conditions = {};
    if (typeof id === 'number') {
      conditions = { id };
    } else {
      conditions = { code: id };
    }
    const result = await service.${lowerCaseName}.findOne({ where: conditions });
    this.success(result, ctx.__('FetchSuccess'));
  }

  async create() {
    const { ctx, service } = this;
    const { body } = ctx.request;
    const result = await service.${lowerCaseName}.create(body);
    this.success(result, ctx.__('CreateSuccess'));
  }

  async update() {
    const { ctx, service } = this;
    const { id } = ctx.params;
    const updateData = { ...ctx.request.body };
    const result = await service.${lowerCaseName}.update(id, updateData);
    this.success(result, ctx.__('UpdateSuccess'));
  }

    // DELETE	/xxxx/:id
    async destroy() {}
}
      `;

  return { template, dir: "app/controller", name: `${name}.ts` }; 
  // template:模板字符串;
  // dir:生成文件路径;
  // name:生成文件名;
};