Skip to content

Commit 92074a9

Browse files
committed
Add UI subproject and modernize build
1 parent edd1cb0 commit 92074a9

File tree

10 files changed

+509
-438
lines changed

10 files changed

+509
-438
lines changed

build.gradle

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
11
plugins {
22
id 'java'
3-
id "com.github.node-gradle.node" version "7.0.2"
4-
id "io.freefair.lombok" version "8.0.1"
5-
id "run.halo.plugin.devtools" version "0.2.0"
3+
id "io.freefair.lombok" version "8.13"
4+
id "run.halo.plugin.devtools" version "0.6.1"
65
}
76

87
group 'cc.ryanc.contenttools'
9-
sourceCompatibility = JavaVersion.VERSION_17
108

119
repositories {
1210
mavenCentral()
13-
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
14-
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
15-
maven { url 'https://repo.spring.io/milestone' }
1611
}
1712

1813
dependencies {
19-
implementation platform('run.halo.tools.platform:plugin:2.19.0-SNAPSHOT')
14+
implementation platform('run.halo.tools.platform:plugin:2.22.0')
2015
compileOnly 'run.halo.app:api'
2116

2217
testImplementation 'run.halo.app:api'
2318
testImplementation 'org.springframework.boot:spring-boot-starter-test'
19+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2420
}
2521

2622
test {
2723
useJUnitPlatform()
2824
}
2925

30-
tasks.withType(JavaCompile).configureEach {
31-
options.encoding = "UTF-8"
26+
java {
27+
toolchain {
28+
languageVersion = JavaLanguageVersion.of(21)
29+
}
3230
}
3331

34-
node {
35-
nodeProjectDir = file("${project.projectDir}/ui")
32+
tasks.withType(JavaCompile).configureEach {
33+
options.encoding = "UTF-8"
34+
options.release = 21
3635
}
3736

38-
tasks.register('buildFrontend', PnpmTask) {
39-
args = ['build']
40-
dependsOn('installDepsForUI')
37+
tasks.register('processUiResources', Copy) {
38+
from project(':ui').layout.buildDirectory.dir('dist')
39+
into layout.buildDirectory.dir('resources/main/console')
40+
dependsOn project(':ui').tasks.named('assemble')
41+
shouldRunAfter tasks.named('processResources')
4142
}
4243

43-
tasks.register('installDepsForUI', PnpmTask) {
44-
args = ['install']
44+
tasks.named('classes') {
45+
dependsOn tasks.named('processUiResources')
4546
}
4647

47-
build {
48-
// build frontend before build
49-
tasks.named('compileJava').configure {
50-
dependsOn('buildFrontend')
51-
}
48+
halo {
49+
version = '2.22'
5250
}
5351

54-
halo {
55-
version = '2.22.7'
56-
}

gradle/wrapper/gradle-wrapper.jar

-17.7 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 21 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pluginManagement {
22
repositories {
3-
maven { url 'https://repo.spring.io/milestone' }
43
gradlePluginPortal()
54
}
65
}
76
rootProject.name = 'plugin-content-tools'
7+
include 'ui'

ui/build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins {
2+
id 'base'
3+
id "com.github.node-gradle.node" version "7.1.0"
4+
}
5+
6+
group 'cc.ryanc.contenttools.ui'
7+
8+
tasks.register('pnpmBuild', PnpmTask) {
9+
group = 'build'
10+
description = 'Build the UI project using pnpm'
11+
args = ['build']
12+
dependsOn tasks.named('pnpmInstall')
13+
inputs.dir(layout.projectDirectory.dir('src'))
14+
inputs.files(fileTree(
15+
dir: layout.projectDirectory,
16+
includes: ['*.cjs', '*.ts', '*.js', '*.json', '*.yaml']))
17+
outputs.dir(layout.buildDirectory.dir('dist'))
18+
}
19+
20+
tasks.register('pnpmCheck', PnpmTask) {
21+
group = 'verification'
22+
description = 'Run unit tests for the UI project using pnpm'
23+
args = ['test:unit']
24+
dependsOn tasks.named('pnpmInstall')
25+
}
26+
27+
tasks.named('check') {
28+
dependsOn tasks.named('pnpmCheck')
29+
}
30+
31+
tasks.named('assemble') {
32+
dependsOn tasks.named('pnpmBuild')
33+
}

ui/package.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"dev": "rsbuild build --env-mode development --watch",
66
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path ../.gitignore",
77
"prettier": "prettier --write src/",
8-
"type-check": "vue-tsc --build --force"
8+
"type-check": "vue-tsc --build --force",
9+
"test:unit": "echo 'No unit tests defined'"
910
},
1011
"prettier": {
1112
"arrowParens": "always",
@@ -21,13 +22,13 @@
2122
"dependencies": {
2223
"@halo-dev/api-client": "^2.22.0",
2324
"@halo-dev/components": "^2.22.0",
24-
"@halo-dev/ui-shared": "^2.22.0",
25+
"@halo-dev/ui-shared": "^2.22.1",
2526
"@joplin/turndown-plugin-gfm": "^1.0.64",
2627
"@tanstack/vue-query": "4",
2728
"@vueuse/core": "^11.3.0",
2829
"@vueuse/router": "^11.3.0",
29-
"axios": "^1.13.2",
30-
"es-toolkit": "^1.43.0",
30+
"axios": "^1.13.4",
31+
"es-toolkit": "^1.44.0",
3132
"gray-matter": "^4.0.3",
3233
"js-yaml": "^4.1.1",
3334
"jszip": "^3.10.1",
@@ -36,34 +37,34 @@
3637
"markdown-it-anchor": "^9.2.0",
3738
"p-queue": "^8.1.1",
3839
"turndown": "^7.2.2",
39-
"vue": "^3.5.26"
40+
"vue": "^3.5.27"
4041
},
4142
"devDependencies": {
4243
"@halo-dev/ui-plugin-bundler-kit": "2.22.0",
43-
"@iconify/json": "^2.2.425",
44+
"@iconify/json": "^2.2.434",
4445
"@rsbuild/core": "^1.7.2",
45-
"@rsbuild/plugin-node-polyfill": "^1.4.2",
46+
"@rsbuild/plugin-node-polyfill": "^1.4.3",
4647
"@rushstack/eslint-patch": "^1.15.0",
4748
"@tsconfig/node20": "^20.1.8",
4849
"@types/js-yaml": "^4.0.9",
4950
"@types/jszip": "^3.4.1",
5051
"@types/markdown-it": "^14.1.2",
51-
"@types/node": "^20.19.27",
52+
"@types/node": "^20.19.30",
5253
"@types/turndown": "^5.0.6",
53-
"@unocss/eslint-config": "^66.5.12",
54-
"@unocss/webpack": "^66.5.12",
54+
"@unocss/eslint-config": "^66.6.0",
55+
"@unocss/webpack": "^66.6.0",
5556
"@vue/eslint-config-prettier": "^9.0.0",
5657
"@vue/eslint-config-typescript": "^13.0.0",
5758
"@vue/tsconfig": "^0.5.1",
5859
"eslint": "^8.57.1",
5960
"eslint-plugin-vue": "^9.33.0",
6061
"jsdom": "^24.1.3",
61-
"prettier": "^3.7.4",
62+
"prettier": "^3.8.1",
6263
"prettier-plugin-organize-imports": "^4.3.0",
6364
"typescript": "~5.5.4",
64-
"unocss": "^66.5.12",
65+
"unocss": "^66.6.0",
6566
"unplugin-icons": "^22.5.0",
6667
"vue-tsc": "^2.2.12"
6768
},
68-
"packageManager": "pnpm@10.27.0"
69+
"packageManager": "pnpm@10.28.2"
6970
}

0 commit comments

Comments
 (0)