Fastdotnet.Plugin.CLI 1.0.3

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet tool install --global Fastdotnet.Plugin.CLI --version 1.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Fastdotnet.Plugin.CLI --version 1.0.3
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Fastdotnet.Plugin.CLI&version=1.0.3
                    
nuke :add-package Fastdotnet.Plugin.CLI --version 1.0.3
                    

Fastdotnet.Plugin.CLI

Fastdotnet 插件项目生成器 - 快速创建前后端一体化的插件项目,支持 Admin 管理端和 App 应用端双前端模板

✨ 特性

  • 🚀 快速生成:一键生成完整的插件项目结构
  • 📦 前后端一体:自动生成后端项目和双前端项目(Admin + App)
  • 🎨 Vue 3 + Vite:基于现代化的前端技术栈
  • 🔌 qiankun 微前端:支持微前端架构
  • 📝 完整模板:包含示例页面、路由配置、菜单初始化等
  • 🛠️ 发布目录:自动生成标准的发布目录结构

安装

作为全局工具安装(推荐)

dotnet tool install -g Fastdotnet.Plugin.CLI

安装后,可以使用 fd-plugin 命令。

从源码构建

cd Fastdotnet.Plugin.CLI
dotnet build
dotnet run

使用方法

交互式模式(推荐新手)

直接运行命令,会引导您完成所有配置:

fd-plugin
# 或
dotnet run

程序会询问:

  • 插件名称
  • 官网申请的 PluginId(必填)
  • 插件描述
  • 输出目录
  • 是否包含前端项目(同时生成 admin 和 app)

命令行模式(适合自动化)

fd-plugin create \
  --name MyPlugin \
  --plugin-id my-plugin-123 \
  --description "My awesome plugin" \
  --output ./plugins \
  --include-frontend \
  --frontend-type vue
参数说明
参数 说明 必需 默认值
--name 插件名称(PascalCase) -
--plugin-id 官网申请的 PluginId -
--description 插件描述 "A Fastdotnet plugin"
--output 输出目录 "."
--no-frontend 不包含前端项目 false

示例

仅后端插件:

fd-plugin create --name BackendOnly --plugin-id backend-only --no-frontend

完整前后端插件:

fd-plugin create \
  --name FullStackPlugin \
  --plugin-id full-stack-demo \
  --description "完整的前后端插件示例"

注意:启用前端时会同时生成管理端(admin)和应用端(app)两个项目

生成的项目结构

MyPlugin/
├── README.md
├── plugin.json                  # 插件元数据
│
├── Backend/                     # 后端项目
│   ├── MyPlugin.csproj
│   ├── MyPluginPlugin.cs        # 主插件类
│   ├── Entities/                # 实体类
│   ├── IService/                # 服务接口
│   ├── Service/                 # 服务实现
│   ├── Controllers/             # API 控制器
│   └── Mappings/                # AutoMapper 配置
│
└── Frontend/                    # 前端项目(可选)
    ├── MyPlugin.Admin/          # 管理端前端
    │   ├── package.json
    │   ├── vite.config.ts
    │   └── src/
    │       ├── main.ts
    │       ├── App.vue
    │       ├── views/
    │       │   └── Home.vue     # 管理端首页
    │       └── api/
    │
    └── MyPlugin.App/            # 应用端前端
        ├── package.json
        ├── vite.config.ts
        └── src/
            ├── main.ts
            ├── App.vue
            ├── views/
            │   └── Home.vue     # 应用端首页
            └── api/

PluginId 验证

CLI 工具会对 PluginId 进行格式验证:

  • ✅ 只允许小写字母、数字和连字符
  • ✅ 必须符合官网注册的 ID
  • ❌ 不允许大写字母、下划线等特殊字符

示例:

  • my-plugin-123
  • payment-gateway
  • MyPlugin
  • my_plugin

开发

本地测试

# 构建
dotnet build

# 运行(交互式)
dotnet run

# 运行(命令行)
dotnet run -- create --name TestPlugin --plugin-id test-plugin

打包为 NuGet 工具

dotnet pack -c Release

# 本地安装测试
dotnet tool install -g --add-source ./nupkg Fastdotnet.Plugin.CLI

发布到 NuGet

dotnet nuget push bin/Release/Fastdotnet.Plugin.CLI.1.0.0.nupkg \
  --api-key YOUR_API_KEY \
  --source https://api.nuget.org/v3/index.json

下一步计划

  • 集成官网 API 验证 PluginId
  • 添加更多前端模板(Vue 3 + TypeScript, React + Vite)
  • 支持从现有插件迁移
  • 添加单元测试
  • 提供 Docker 调试配置模板

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!


文档: https://docs.fastdotnet.top/plugins
官网: https://fastdotnet.top

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.0.4-preview.0.2 50 5/17/2026
1.0.3 108 4/26/2026
1.0.2 108 4/25/2026
1.0.1 98 4/13/2026
1.0.0 111 4/13/2026
0.0.0-preview.0.3 59 4/13/2026