2 releases
| 0.0.2 | Jun 13, 2023 |
|---|---|
| 0.0.1 | May 8, 2023 |
#7 in #pnpm
520KB
596 lines
create-vue-business-rs
Generate a CLI for business projects in the
packagesdirectory of a pnpm monorepo working repository.
Refactor the
create-vue-businessCLI library using Rust. The original library was built using ESM.
| 技术栈 | 版本 |
|---|---|
| rust | 1.67.1 |
| dialoguer | 0.10.3 |
| console | 0.15.5 |
| termcolor | 1.2.0 |
| regex | 1.7.3 |
| serde_json | 1.0.159 |
| git2 | 0.17.0 |
使用
目前仅支持
cargo install安装方式
- 下载安装
cargo install create-vue-business-rs
- 使用
# 输入create-vue-business-rs,按回车键即可
create-vue-business-rs
TODO 待修改

开发指南
- 下载&安装依赖
git clone https://github.com/laqudee/create-vue-business-rs.git
cd create-vue-business-rs
cargo install
cargo run
- 构建正式包
cargo build --release
- 发布到
crates.io
cargo publish
构建过程
- 首先将模板
template放到根目录下,分为base,code,config这三个子目录,根据选择的配置不同,进行渲染。 - 使用
dialoguer库,生成命令行配置选择 - 根据选择的配置,执行
render()函数进行渲染 - 使用
git2库初始化 git - 渲染完成,输出提示信息
- 退出程序
待解决的问题
-
使用 Rust 操作文件及目录 -
文件渲染 - 命令打包的方式及提供几种构建方式
- 目前支持
cargo install create-vue-business-rs方式安装使用
- 目前支持
-
git2库没有生效 - 生成的
package.json内容按照字母顺序排序了,不符合正常的package.json顺序 - 是否转为 npm 命令
参考
使用Rust写的CLI工具库
已经发布的Crate包
原版使用JavaScript写的CLI工具库
-
create-vue-monorepo,仿照create-vue写了一个生成一个pnpm monorepo 的工作仓库的简单CLI -
create-vue-business,仿照create-vue写了一个生成一个 pnpm monorepo 的工作仓内部packages目录下业务项目的 CLI
已经发布的NPM包
Dependencies
~15–27MB
~455K SLoC