Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nebula CLI

快速创建 Nebula 框架项目的命令行工具。

安装

从源码编译

git clone https://github.com/gOODiDEA2002/nebula-cli.git
cd nebula-cli
go build -o nebula .

使用

创建微服务项目

# 交互式创建
nebula init

# 快速创建
nebula init my-service --type=service

# 创建完整微服务项目(包含多个服务)
nebula init my-project --type=multi-service --services=user,order

可用模板

模板 命令 说明
multi-service --type=multi-service 完整微服务项目
service --type=service 单个微服务
web --type=web Web 应用
gateway --type=gateway API 网关
lib --type=lib 公共库模块
minimal --type=minimal 最小化应用
api --type=api RPC 契约模块

其他命令

# 列出可用模板
nebula templates

# 检查开发环境
nebula doctor

# 查看版本
nebula version

命令参数

init 命令

nebula init [project-name] [flags]
参数 说明 默认值
-t, --type 项目类型 -
-g, --group Maven groupId com.example
--version 项目版本 1.0.0-SNAPSHOT
--package 基础包名 自动生成
--nebula-version Nebula 框架版本 2.0.1-SNAPSHOT
--services 服务列表 (multi-service) user,order
--no-gateway 不包含网关 false
--no-lib 不包含公共库 false
-y, --yes 跳过确认 false

示例

创建微服务

nebula init user-service --type=service --group=com.example --yes

生成结构:

user-service/
├── pom.xml
├── README.md
└── src/main/java/com/example/userservice/
    ├── UserServiceApplication.java
    ├── controller/
    └── service/

user-service-api/
├── pom.xml
└── src/main/java/com/example/userservice/api/
    ├── UserRpcClient.java
    └── dto/

创建完整微服务项目

nebula init my-project --type=multi-service \
  --services=user,order,payment \
  --group=com.example \
  --yes

生成结构:

my-project/
├── pom.xml
├── my-project-lib/
├── my-project-user-api/
├── my-project-user/
├── my-project-order-api/
├── my-project-order/
├── my-project-payment-api/
├── my-project-payment/
└── my-project-gateway/

开发

构建

make build

测试

make test

发布

make release

许可证

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages