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

yadea-cli

v1.0.1

Published

Yadea 前端模板下载 CLI 工具

Readme

yadea-cli

Yadea 前端脚手架 CLI 工具,用于从内部 GitLab 下载模板、创建项目、生成代码文件和同步模板更新。

安装

# 全局安装后直接使用 yadea 命令
npm install -g yadea-cli

# 或从源码链接(开发环境)
npm link

命令一览

| 命令 | 说明 | |------|------| | yadea create [project-name] | 创建新项目(完整流程) | | yadea down | 简化版下载模板 | | yadea generate [type] [name] | 生成代码文件(别名:g) | | yadea g:page <name> | 快速生成页面 | | yadea g:component <name> | 快速生成组件(别名:g:comp) | | yadea g:api <name> | 快速生成 API 模块 | | yadea g:store <name> | 快速生成 Store 模块 | | yadea g:hook <name> | 快速生成 Hook | | yadea upgrade | 升级同步模板配置 | | yadea upgrade --check | 仅检查更新,不执行 |


yadea create

从内部 GitLab 拉取模板,完整走完认证、选模板、功能裁剪、安装依赖流程,生成可直接开发的项目。

yadea create
yadea create my-project

流程说明:

  1. GitLab 认证 — 依次尝试 OAuth2、Session、Personal Access Token,token 有效期 1 天,无需每次重复登录

  2. 选择模板 — 列举 GitLab front-end-template 组下的所有项目,选一个作为起点

  3. 填写项目信息 — 输入项目名称、选择功能模块

  4. 功能模块裁剪 — 按需保留或移除以下模块:

    Vue3 模板可选功能:

    • ESLint + Prettier(代码规范,默认开启)
    • Husky + CommitLint(Git 提交规范,默认开启)
    • Axios 封装(HTTP 请求,默认开启)
    • Pinia Store(状态管理,默认开启)
    • Vue Router(路由管理,默认开启)
    • 权限模块(登录/权限控制)
    • Mock 数据(开发模拟)

    uni-app 模板可选功能:

    • ESLint + Prettier(代码规范,默认开启)
    • Husky + CommitLint(Git 提交规范,默认开启)
    • 请求封装 uni.request(默认开启)
    • Pinia Store(状态管理,默认开启)
    • 登录模块(微信登录)
    • 分包配置
  5. 初始化 Git 仓库(可选)

  6. 自动安装依赖(可选)

项目创建完成后,根目录会生成 .yadea.json 配置文件,记录模板来源和类型,供后续 generateupgrade 命令使用。


yadea down

无需完整配置流程,快速下载模板到当前目录。

yadea down

适合临时获取模板代码,不写入 .yadea.json


yadea generate / yadea g

在已有项目中生成代码文件,自动根据 .yadea.jsonpackage.json 检测项目类型(Vue3 / uni-app),读取对应模板后写入文件。

# 交互式(逐步提示类型和名称)
yadea generate
yadea g

# 指定类型和名称
yadea generate page user-list
yadea g component UserCard
yadea g api user
yadea g store auth
yadea g hook useScroll

支持的生成类型:

| 类型 | 输出目录 | 文件格式 | 文件命名 | |------|----------|----------|----------| | page | src/pages/ | .vue | 原始名称 | | component | src/components/ | .vue | 原始名称 | | api | src/api/ | .js | camelCase | | store | src/store/ | .js | camelCase | | hook | src/hooks/ | .js | PascalCase |

名称命名规则:

输入名称后,模板中可使用以下四种格式变量:

| 变量 | 说明 | 示例(输入 user-detail) | |------|------|--------------------------| | {{kebabName}} | 短横线 | user-detail | | {{camelName}} | 小驼峰 | userDetail | | {{pascalName}} | 大驼峰 | UserDetail | | {{originalName}} | 原始输入 | user-detail |

支持子目录:

名称中可以使用 / 生成到子目录,输出路径会自动拼接。

# 生成到 src/pages/users/detail.vue
yadea g:page users/detail

# 生成到 src/api/users/profile.js
yadea g:api users/profile

快捷命令:

yadea g:page <name>         # 等同于 yadea g page <name>
yadea g:component <name>    # 等同于 yadea g component <name>
yadea g:comp <name>         # g:component 的别名
yadea g:api <name>          # 等同于 yadea g api <name>
yadea g:store <name>        # 等同于 yadea g store <name>
yadea g:hook <name>         # 等同于 yadea g hook <name>

yadea upgrade

将远程模板的最新依赖版本和配置文件同步到当前项目,支持选择性更新,更新前自动备份。

# 检查并执行更新
yadea upgrade

# 仅检查,不修改文件
yadea upgrade --check

备份说明: 每次执行更新前,受影响的文件会备份到 .yadea-backup/{timestamp}/ 目录。


项目类型检测

generateupgrade 命令依赖项目类型。检测优先级如下:

  1. .yadea.json 中的 templateType 字段
  2. package.json 中的依赖特征:
    • 包含 @dcloudio/uni-app → uni-app
    • 包含 vue ^3.x → Vue3
  3. 无法识别时,交互式提示手动选择

开发调试

# 从源码直接运行
node bin/yadea.js create
node bin/yadea.js g page my-page

# 链接全局命令
npm link

# 卸载全局链接
npm unlink