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

quick-gen-file

v1.0.0

Published

🚀 一个快速文件生成脚手架,适用于 Node.js / 前端 / 任意项目。助你高效创建文件结构,提升开发效率。

Readme

🚀 QuickGenFile

快速创建模块、页面或模板文件,告别重复劳动!

✨ 特性

  • 📁 一键生成 Vue/React/Node 等项目的标准化文件目录
  • 🎨 模板引擎支持 (EJS/Mustache)
  • ⚙️ 动态配置 通过 qg-config.json 自定义生成规则

📦 安装

npm install -g quick-gen-file
或
yarn global add quick-gen-file

🛠 基础使用

1. 快速生成 Vue3 页面

qg add-vuepage home -d src/views

生成结构:

src/views/
└── home/
    ├── home.vue

2. 初始化高级配置模板

qg init

该命令会生成 qg-config.json 文件和 qg-template 模板目录。

随后,你可以通过以下命令生成页面结构:

执行

qg add-my-page user

运行结果

$ qg add-my-page user
✓ [2025/05/23 15:47:53] 模板已成功生成到: src\views\test_qg_page\user\user.ts
✓ [2025/05/23 15:47:53] 模板已成功生成到: src\views\test_qg_page\user\Uservue2.vue
✓ [2025/05/23 15:47:53] 模板已成功生成到: src\views\test_qg_page\user\Uservue3.vue

⚡ 高级配置指南

1. 创建配置文件

在项目根目录新建 qg-config.json

{
  "commands": [
    {
      "name": "add-my-page",
      "description": "生成Pinia状态模块",
      "templates": [
        {
          "templatePath": "qg-template/store.ejs",
          "output": "src/stores/{{lowerName}}.ts"
        }
      ]
    }
  ]
}

2. 模板文件示例

templates/store.ejs 内容:

import { defineStore } from 'pinia'

export const use<%= capitalizeName %>Store = defineStore('<%= name %>', {
  state: () => ({
    // 自动生成的Store
  })
})

3. 运行效果

qg add-store user

生成文件:src/stores/user.ts (自动转换变量)

4. 配置参数详解

| 参数 | 类型 | 必填 | 默认值 | 说明 | | :--------------------------: | :-----: | :--: | :------: | :------------------------------------------: | | name | string | ✅ | - | 命令名称(调用时使用) | | description | string | ❌ | - | 命令描述(显示在帮助信息中) | | askForName | boolean | ❌ | false | 是否要求输入名称参数 | | templates[].templatePath | string | ✅ | - | 模板文件路径 或 你要复制的文件路径 | | templates[].output | string | ✅ | - | 生成目标路径(支持变量)支持{{name}}语法替换 | | templates[].filename | string | ❌ | 原文件名 | 生成的文件名(可选覆盖)支持{{name}}语法替换 |

5. {{name}} 值来源说明

qg add-store user

user 将作为 {{name}} 注入到模板或者路径中。

6.动态变量说明

模板支持以下自动注入的变量,可用于路径、文件名和模板内容中:

| 变量名 | 示例输入 | 转换结果 | 说明 | | -------------------- | ------------- | ------------- | ---------- | | {{name}} | userProfile | userProfile | 原始输入 | | {{lowerName}} | UserProfile | userprofile | 全部小写 | | {{upperName}} | userProfile | USER | 全部大写 | | {{capitalizeName}} | user | User | 首字母大写 |

🔧 开发调试

克隆项目
git clone https://github.com/yydongwang/quick-gen-file.git

安装依赖
npm install

编译并监听变化
npm run build

本地测试
npm link
qg --version

🤝 贡献指南

  1. Fork 项目
  2. 创建分支 (git checkout -b feat/xxxx)
  3. 提交修改 (git commit -am 'feat: add xxxxx')
  4. 推送分支 (git push origin feat/xxxx)
  5. 发起 Pull Request

Git 贡献提交规范

  • feat 新功能
  • fix Bug修复
  • docs 文档更新
  • style 代码格式调整(不影响功能)
  • refactor 代码重构(非功能/非Bug)
  • perf 性能优化
  • test 测试相关
  • chore 构建流程或工具链变更
  • revert 代码回退
  • init 项目初始化
  • build 构建系统或依赖变更
  • wip 正在开发中

📜 许可证

MIT