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

fool-coder

v1.0.0

Published

A code generator for Vue and React, mainly to do the CRUD. It may help you write less code, but it can't replace you.

Downloads

4

Readme

fool-coder

vue,react代码生成器,基于node和ejs模板引擎,根据领域对象和一套通用模板生成通用的CRUD代码,减少重复的复制粘贴。

字段说明

const User = {
  file: 'vue',
  data: 'user',
  basicPath: '/basic/path',
  create: { api: '/v1/user/create', router: 'userCreate' },
  list: { api: '/v1/user/list', router: 'userList' },
  detail: { api: '/v1/user/detail', router: 'userDetail' },
  update: { api: '/v1/user/update', router: 'userUpdate' },
  fields: {
    id: {
      type: 'number', title: '编号', primary: true, inDetail: { cannotEdit: true },
    },
    name: {
      title: '姓名', inTable: {}, inDetail: {}, filter: { source: '/v1/user/suggest', value: 'id', text: 'name' },
    },
    city: {
      type: 'number', key: 'city_code', title: '城市', inDetail: {}, selector: { value: 'city_code', text: 'city_name', source: '/v1/city/suggest' }, filter: {},
    },
    cityDisplay: { key: 'city_display', title: '城市', inTable: {} },
    birthday: {
      type: 'date', key: 'birthday', title: '出生日期', inTable: {}, inDetail: {}, selector: {},
    },
    operation: { key: 'operation', title: '操作', inTable: { needRender: true } },
  },
}

类的描述字段

  • data: 对应的结构体名称,或表名简称
  • basicPath: 基础路由
  • create: 新增的api地址以及页面路由名称,对应api和router,下同
  • list: 列表的api地址以及页面路由名称
  • detail: 详情的api地址以及页面路由名称
  • update: 更新的api地址以及页面路由名称
  • fields: 对象的属性列表

属性的描述字段

  • key: 对应后端接口的字段名,默认值与属性名相同,可省略。
  • type: 数据类型,默认为字符串,可省略。
  • title: 在列表中或详情页中的Label名称,字段的含义,默认值为''。
  • inTable: 在列表中展示此项,inTable.needRender表示此项的值需要复杂操作,渲染成一个空的render函数,附加TODO标识。
  • inDetail: 在详情中展示此项,inDetail.cannotEdit设置此项是否可以新增和修改,默认inDetail的项都可以新增和修改。
  • selector: 表示该字段不是文本输入,而是选择框,source表示各选项的数据源,即api地址,value表示每一个选项的值,text表示每一个选项的展示文字,自动识别date类型,渲染日期选择器。
  • filter: 表示该字段可以在列表中作为查询条件,参数与selector相同且公用。

重点:另外还有primary,是主键字段,inTable会自动变成超链接,跳转到对应的详情页面,并且inDetail.cannotEdit自动设为true