Skip to content

Commit

Permalink
perf: refactor API request implementation and upgrade Halo dependency…
Browse files Browse the repository at this point in the history
… to 2.17 (#163)

使用 openapi-generator 重构请求库
使用 @halo-dev/api-client 提供的axiosInstance
提升所有 Halo 依赖版本至2.17
```release-note
None
```
  • Loading branch information
longjuan authored Jul 14, 2024
1 parent 63be3ed commit d4df735
Show file tree
Hide file tree
Showing 64 changed files with 6,062 additions and 2,855 deletions.
38 changes: 34 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ plugins {
id 'java'
id "com.github.node-gradle.node" version "5.0.0"
id "io.freefair.lombok" version "8.0.1"
id "run.halo.plugin.devtools" version "0.0.7"
id "run.halo.plugin.devtools" version "0.0.9"
id 'org.openapi.generator' version '7.7.0'
}

group 'run.halo.s3os'
sourceCompatibility = JavaVersion.VERSION_17

java {
sourceCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenCentral()
Expand All @@ -16,7 +20,7 @@ repositories {
}

dependencies {
implementation platform('run.halo.tools.platform:plugin:2.14.0-SNAPSHOT')
implementation platform('run.halo.tools.platform:plugin:2.17.0-SNAPSHOT')
compileOnly 'run.halo.app:api'

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


halo {
version = '2.14.0'
version = '2.17.0'
}

haloPlugin {
Expand Down Expand Up @@ -67,3 +71,29 @@ build {
// build frontend before build
tasks.getByName('compileJava').dependsOn('buildFrontend')
}


task downloadOpenApiSpec {
doLast {
def url = 'http://localhost:8090/v3/api-docs/plugin-s3'
def file = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile
file.parentFile.mkdirs()
file.text = new URL(url).text
}
}

openApiGenerate {
generatorName = "typescript-axios"
inputSpec = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile.getAbsolutePath()
outputDir = "${projectDir}/console/src/api"
additionalProperties = [
useES6: true,
useSingleRequestParameter: true,
withSeparateModelsAndApi: true,
apiPackage: "api",
modelPackage: "models"
]
typeMappings = [
set: "Array"
]
}
46 changes: 24 additions & 22 deletions console/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@halo-dev/plugin-starter",
"name": "@halo-dev/plugin-s3",
"version": "1.0.0",
"private": true,
"scripts": {
Expand All @@ -11,38 +11,40 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@halo-dev/api-client": "^2.11.0",
"@halo-dev/components": "^1.10.0",
"@halo-dev/console-shared": "^2.11.0",
"@halo-dev/api-client": "^2.17.0",
"@halo-dev/components": "^2.17.0",
"@halo-dev/console-shared": "^2.17.0",
"@tanstack/vue-query": "4.29.1",
"axios": "^1.4.0",
"axios": "^1.7.2",
"canvas-confetti": "^1.6.0",
"path-browserify": "^1.0.1",
"vue": "^3.3.4"
"vue": "^3.4.27"
},
"devDependencies": {
"@halo-dev/ui-plugin-bundler-kit": "^2.12.0",
"@halo-dev/ui-plugin-bundler-kit": "^2.17.0",
"@iconify/json": "^2.2.18",
"@rushstack/eslint-patch": "^1.2.0",
"@tsconfig/node18": "^18.2.4",
"@types/canvas-confetti": "^1.6.0",
"@types/jsdom": "^20.0.0",
"@types/node": "^16.18.0",
"@vitejs/plugin-vue": "^3.1.2",
"@vitejs/plugin-vue-jsx": "^2.0.1",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.2.0",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.26.0",
"eslint-plugin-vue": "^9.6.0",
"jsdom": "^19.0.0",
"@types/node": "^18.11.19",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.43.0",
"eslint-plugin-vue": "^9.17.0",
"jsdom": "^20.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"sass": "^1.58.0",
"typescript": "~4.7.4",
"typescript": "~5.3.0",
"unplugin-icons": "^0.15.2",
"vite": "^3.1.8",
"vitest": "^0.24.3",
"vue-tsc": "^1.0.9"
"vite": "^5.0.0",
"vitest": "^0.34.1",
"vue-router": "^4.4.0",
"vue-tsc": "^1.8.27"
}
}
Loading

0 comments on commit d4df735

Please sign in to comment.