uni-lib-cli
v0.1.4
Published
uni-lib 多端前端项目脚手架
Maintainers
Readme
uni-lib-cli
uni-lib 多端前端项目脚手架,支持从模版快速创建工程。
支持的模版
| 模版 | 说明 |
| --- | --- |
| admin-web | Vue 3 管理后台(Element Plus + uni-ui-lib) |
| customer-web | Nuxt 3 C 端站点 |
| customer-mobile | uni-app 移动端跨端 |
| native-app | Flutter 原生应用骨架 |
使用方式
全局安装
npm install -g uni-lib-cli
uni-lib-cli createMonorepo 本地调试
cd uni-lib-cli
npm install
npm run build
node dist/index.js create
# 或
npm run dev非交互创建
uni-lib-cli create my-admin --template admin-web
uni-lib-cli create my-admin --template admin-web --dir ./apps --force模版来源
创建项目时按以下顺序查找模版目录:
- monorepo 同级目录(如
../admin-web) - 包内
templates/<模版名>/
开发 monorepo 时会优先使用仓库内最新工程;发布后使用 npm 包内 bundled templates。
发布
npm run release # 默认 patch 递增并发布
npm run release -- minor # minor 版本
npm run release -- major # major 版本流程:同步模版 → 构建 → 递增版本 → npm publish。版本号不会自动 git commit/tag,发布后可自行提交。
单独同步模版(不发布):
npm run sync:templates本地 npm 认证:复制 .npmrc.example 为 .npmrc 并配置 token(勿提交 .npmrc)。
开发
- Node.js >= 18.12.0
npm run build— 编译 TypeScript 到dist/npm run dev— 直接运行src/index.ts(tsx)npm run sync:template:admin-web— 从admin-web同步模版(工作台 + 路线规划、协议管理、学生档案)
