@sarch/create-your-app
v1.1.0
Published
管理并使用你自己的模版,快速创建项目。A CLI tool to manage your templates and create projects from Git repositories.
Maintainers
Readme
@sarch/create-your-app
管理并使用你自己的模版,快速创建项目。
一个交互式脚手架工具,帮助你管理 Git 模版仓库,并从中一键创建新项目。内置模版列表管理,支持添加、删除、设为默认,让你打造属于自己的项目模版库。
功能特性
- 🎯 模版管理 — 交互式模版列表,支持添加、删除、设为默认
- ⭐ 默认模版 — 标记常用模版为默认,下次直接选中
- 🔗 自动收录 — 使用
--template指定新地址时自动添加到模版库 - 🚀 交互式 UI — 基于 Ink 的漂亮终端界面,键盘操作流畅
- ✅ 项目冲突检测 — 自动检测目录是否已存在,避免覆盖
- 🧹 干净的起点 — 克隆后自动移除
.git,让新项目成为独立仓库
安装
使用 npx(无需安装):
npx @sarch/create-your-app全局安装:
npm install -g @sarch/create-your-app使用方法
交互式创建项目(推荐)
不带参数运行,进入模版选择界面:
create-your-app模版选择界面支持以下操作:
| 按键 | 功能 |
| ------- | ------------------ |
| ↑ ↓ | 切换选择模版 |
| ↵ | 确认使用当前模版 |
| a | 添加自定义模版 |
| d | 删除当前模版 |
| s | 将当前模版设为默认 |
| q | 退出 |
直接指定项目名
create-your-app my-project会先进入模版选择,选择后直接开始创建。
指定模版地址
使用 --template 或 -t 参数直接指定 Git 仓库地址,跳过模版选择:
create-your-app my-project -t https://github.com/user/repo如果该地址不在模版列表中,会自动添加(别名从仓库地址提取)。
查看帮助和版本
create-your-app -h # 显示帮助信息
create-your-app -v # 显示版本号选项
| 选项 | 简写 | 说明 |
| ------------ | ---- | ----------------------------------- |
| --template | -t | 指定模版 Git 仓库地址,跳过交互选择 |
| --help | -h | 显示帮助信息 |
| --version | -v | 显示版本号 |
模版数据
模版列表存储在 ~/.create-your-app/templates.json,你可以直接编辑该文件管理模版,也可以通过交互界面操作。
初始内置模版:
| 别名 | 地址 |
| -------------------- | --------------------------------------------------- |
| react-app-template | https://helpwx.com/webplus/react-app-template.git |
License
MIT
