feat: 插件骨架(里程碑 1)

- Gradle 工程:devtools 0.8.0 + 平台 BOM 2.26.0,JDK 21 toolchain
- plugin.yaml:operation-audit,requires >=2.26.0
- OperationAuditPlugin 入口(@Component)
- ui 子项目:Vue 3 + Vite 6 + @halo-dev/components 2.26.0,占位页 + 菜单注册,npm 构建(legacy-peer-deps 对齐 pnpm 行为)
- ./gradlew build 通过,jar 内含 plugin.yaml / console 前端产物 / 组件索引
This commit is contained in:
2026-11-21 16:07:37 +08:00
parent a14cd433b6
commit 5e6ee00268
19 changed files with 2677 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# console-shared 2.21.0 的 vue-router peer 元数据过时(官方生态已迁移 vue-router 5),
# npm 严格 peer 解析会误报冲突;pnpm 默认不因 peer 冲突失败,此处对齐该行为。
legacy-peer-deps=true
+35
View File
@@ -0,0 +1,35 @@
plugins {
id 'base'
id "com.github.node-gradle.node" version "7.1.0"
}
group = 'run.halo.operationaudit.ui'
node {
// 使用系统已安装的 Node/npm,不额外下载
download = false
}
// 前端构建(npm run build = 类型检查 + vite 打包,产物输出到 build/dist)
tasks.register('buildFrontend', NpmTask) {
group = 'build'
description = 'Builds the Console UI bundle.'
args = ['run', 'build']
inputs.files(
fileTree('src'),
fileTree('public'),
file('package.json'),
file('vite.config.ts'),
file('tsconfig.json'),
)
outputs.dir(layout.buildDirectory.dir('dist'))
dependsOn tasks.named('npmInstall')
}
tasks.named('check') {
dependsOn tasks.named('buildFrontend')
}
tasks.named('assemble') {
dependsOn tasks.named('buildFrontend')
}
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
{
"name": "plugin-operation-audit-ui",
"private": true,
"type": "module",
"scripts": {
"build": "npm run type-check && npm run build-only",
"build-only": "vite build",
"dev": "vite build --watch --mode=development",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@halo-dev/api-client": "2.26.0",
"@halo-dev/components": "2.26.0",
"@halo-dev/console-shared": "^2.21.0",
"vue": "^3.5.13"
},
"devDependencies": {
"@halo-dev/ui-plugin-bundler-kit": "2.26.0",
"@types/node": "^20.19.1",
"@vitejs/plugin-vue": "^5.2.4",
"@vue/tsconfig": "^0.7.0",
"typescript": "~5.8.3",
"vite": "^6.0.0",
"vue-tsc": "^2.2.10"
}
}
+7
View File
@@ -0,0 +1,7 @@
/// <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
+26
View File
@@ -0,0 +1,26 @@
import { definePlugin } from '@halo-dev/console-shared'
import { markRaw } from 'vue'
import { IconEye } from '@halo-dev/components'
import HomeView from '@/views/HomeView.vue'
export default definePlugin({
components: {},
routes: [
{
path: '/operation-audit',
name: 'OperationAudit',
component: HomeView,
meta: {
title: '操作审计',
searchable: true,
menu: {
name: '操作审计',
group: 'plugin',
icon: markRaw(IconEye),
priority: 0,
},
},
},
],
extensionPoints: {},
})
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { VAlert } from '@halo-dev/components'
</script>
<template>
<VAlert
type="info"
title="操作审计"
:closable="false"
>
插件骨架已就绪,审计日志查看页将在后续里程碑实现。
</VAlert>
</template>
+18
View File
@@ -0,0 +1,18 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"jsx": "preserve",
"skipLibCheck": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"types": ["vite/client", "node"]
},
"include": ["src/**/*.ts", "src/**/*.vue", "vite.config.ts"]
}
+13
View File
@@ -0,0 +1,13 @@
import { viteConfig } from '@halo-dev/ui-plugin-bundler-kit/vite'
import { fileURLToPath, URL } from 'url'
// 官方 ui-plugin-bundler-kit 负责外部化 vue / @halo-dev/* 依赖并输出 console/main.js
export default viteConfig({
vite: {
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
},
})