Skip to content

Commit d4df735

Browse files
authored
perf: refactor API request implementation and upgrade Halo dependency to 2.17 (#163)
使用 openapi-generator 重构请求库 使用 @halo-dev/api-client 提供的axiosInstance 提升所有 Halo 依赖版本至2.17 ```release-note None ```
1 parent 63be3ed commit d4df735

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6062
-2855
lines changed

build.gradle

+34-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ plugins {
22
id 'java'
33
id "com.github.node-gradle.node" version "5.0.0"
44
id "io.freefair.lombok" version "8.0.1"
5-
id "run.halo.plugin.devtools" version "0.0.7"
5+
id "run.halo.plugin.devtools" version "0.0.9"
6+
id 'org.openapi.generator' version '7.7.0'
67
}
78

89
group 'run.halo.s3os'
9-
sourceCompatibility = JavaVersion.VERSION_17
10+
11+
java {
12+
sourceCompatibility = JavaVersion.VERSION_17
13+
}
1014

1115
repositories {
1216
mavenCentral()
@@ -16,7 +20,7 @@ repositories {
1620
}
1721

1822
dependencies {
19-
implementation platform('run.halo.tools.platform:plugin:2.14.0-SNAPSHOT')
23+
implementation platform('run.halo.tools.platform:plugin:2.17.0-SNAPSHOT')
2024
compileOnly 'run.halo.app:api'
2125

2226
implementation platform('software.amazon.awssdk:bom:2.19.8')
@@ -36,7 +40,7 @@ configurations.runtimeClasspath {
3640

3741

3842
halo {
39-
version = '2.14.0'
43+
version = '2.17.0'
4044
}
4145

4246
haloPlugin {
@@ -67,3 +71,29 @@ build {
6771
// build frontend before build
6872
tasks.getByName('compileJava').dependsOn('buildFrontend')
6973
}
74+
75+
76+
task downloadOpenApiSpec {
77+
doLast {
78+
def url = 'http://localhost:8090/v3/api-docs/plugin-s3'
79+
def file = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile
80+
file.parentFile.mkdirs()
81+
file.text = new URL(url).text
82+
}
83+
}
84+
85+
openApiGenerate {
86+
generatorName = "typescript-axios"
87+
inputSpec = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile.getAbsolutePath()
88+
outputDir = "${projectDir}/console/src/api"
89+
additionalProperties = [
90+
useES6: true,
91+
useSingleRequestParameter: true,
92+
withSeparateModelsAndApi: true,
93+
apiPackage: "api",
94+
modelPackage: "models"
95+
]
96+
typeMappings = [
97+
set: "Array"
98+
]
99+
}

console/package.json

+24-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@halo-dev/plugin-starter",
2+
"name": "@halo-dev/plugin-s3",
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
@@ -11,38 +11,40 @@
1111
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
1212
},
1313
"dependencies": {
14-
"@halo-dev/api-client": "^2.11.0",
15-
"@halo-dev/components": "^1.10.0",
16-
"@halo-dev/console-shared": "^2.11.0",
14+
"@halo-dev/api-client": "^2.17.0",
15+
"@halo-dev/components": "^2.17.0",
16+
"@halo-dev/console-shared": "^2.17.0",
1717
"@tanstack/vue-query": "4.29.1",
18-
"axios": "^1.4.0",
18+
"axios": "^1.7.2",
1919
"canvas-confetti": "^1.6.0",
2020
"path-browserify": "^1.0.1",
21-
"vue": "^3.3.4"
21+
"vue": "^3.4.27"
2222
},
2323
"devDependencies": {
24-
"@halo-dev/ui-plugin-bundler-kit": "^2.12.0",
24+
"@halo-dev/ui-plugin-bundler-kit": "^2.17.0",
2525
"@iconify/json": "^2.2.18",
2626
"@rushstack/eslint-patch": "^1.2.0",
27+
"@tsconfig/node18": "^18.2.4",
2728
"@types/canvas-confetti": "^1.6.0",
2829
"@types/jsdom": "^20.0.0",
29-
"@types/node": "^16.18.0",
30-
"@vitejs/plugin-vue": "^3.1.2",
31-
"@vitejs/plugin-vue-jsx": "^2.0.1",
32-
"@vue/eslint-config-prettier": "^7.0.0",
33-
"@vue/eslint-config-typescript": "^11.0.2",
34-
"@vue/test-utils": "^2.2.0",
35-
"@vue/tsconfig": "^0.1.3",
36-
"eslint": "^8.26.0",
37-
"eslint-plugin-vue": "^9.6.0",
38-
"jsdom": "^19.0.0",
30+
"@types/node": "^18.11.19",
31+
"@vitejs/plugin-vue": "^5.0.4",
32+
"@vitejs/plugin-vue-jsx": "^3.1.0",
33+
"@vue/eslint-config-prettier": "^7.1.0",
34+
"@vue/eslint-config-typescript": "^11.0.3",
35+
"@vue/test-utils": "^2.4.6",
36+
"@vue/tsconfig": "^0.5.1",
37+
"eslint": "^8.43.0",
38+
"eslint-plugin-vue": "^9.17.0",
39+
"jsdom": "^20.0.3",
3940
"npm-run-all": "^4.1.5",
40-
"prettier": "^2.7.1",
41+
"prettier": "^2.8.8",
4142
"sass": "^1.58.0",
42-
"typescript": "~4.7.4",
43+
"typescript": "~5.3.0",
4344
"unplugin-icons": "^0.15.2",
44-
"vite": "^3.1.8",
45-
"vitest": "^0.24.3",
46-
"vue-tsc": "^1.0.9"
45+
"vite": "^5.0.0",
46+
"vitest": "^0.34.1",
47+
"vue-router": "^4.4.0",
48+
"vue-tsc": "^1.8.27"
4749
}
4850
}

0 commit comments

Comments
 (0)