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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sandfish

v0.10.13

Published

create antd table columns and form items from db

Readme

sandfish

这是一个根据mysql数据库自动生成 antd 的表格列配置、表单配置以及一个枚举自动化创建文件的脚本

字典和权限脚本已经单独拆开: enum-maker

Install

npm install sandfish
## or
yarn add sandfish

Usage

我们认为用数字命名枚举是不合法且毫无可读性可言的行为,会使系统陷入迭代维护困境。插件会自动为你过滤用数字命名的枚举,

如果提示 Cannot find module 'mysql',请安装一下该依赖,因为这个库引用了 readable-stream 还有一个暂未关闭的Circular dependencies,暂时没有将该包打包进去

const { generateColumns } = require('sandfish');
const config = {
  connectionConfig: {
    host: 'localhost',
    user: 'root',
    password: '949440946',
  },
  dataBaseNames: ['DYLAN'], // 数据库名字
  outputPath: './tests/.output', // 输出目录
  ignoreTableNames: ['database_history'], // 不生成表格表单配置的黑名单
  needFormConfig: true, // 是否需要生成表单配置, 默认关闭
};
generateColumns(config);

Columns

在日常表格开发中,我们经常需要根据数据库的列配置书写本地表格的列配置,然后传入我们的antd/table组件

// code examples
/**
 * @description 用户名称
 */
export const username: ColumnType<string> = {
  title: '用户名称',
  dataIndex: 'username',
};

Form

关于表单我们先同步一个概念,表单组件颗粒的定义,如下UserFormItem就是一个表单组件颗粒

const UserFormItem = (
  <Item name="user" label="用户名称" {...itemProps}>
    <ActionInputComponents>
  </Item>
)

如果选用组件开发,颗粒的属性[name, label]都可以复用,所以我们会自动生成这部分复用json,这时候可能复用率还不够明显。 如果你是用formily,这个配置在schema json的复用率会有明显的提升

/**
 * @description 用户名称
 */
export const usernameFormConfig: FormConfig = {
  label: '用户名称',
  name: 'username',
};