Skip to content

Commit 7ccc9c5

Browse files
authored
chore: improve the project infrastructure (#16)
Signed-off-by: Ryan Wang <[email protected]>
1 parent 2374558 commit 7ccc9c5

25 files changed

+1305
-1514
lines changed

.github/workflows/workflow.yaml

+39-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ name: Build Plugin JAR File
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
7+
paths:
8+
- "**"
9+
- "!**.md"
610
release:
711
types:
812
- created
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- "**"
18+
- "!**.md"
919

1020
jobs:
1121
build:
@@ -17,18 +27,18 @@ jobs:
1727
- name: Set up JDK 17
1828
uses: actions/setup-java@v2
1929
with:
20-
distribution: 'temurin'
21-
cache: 'gradle'
30+
distribution: "temurin"
31+
cache: "gradle"
2232
java-version: 17
2333
- name: Set up Node.js
2434
uses: actions/setup-node@v3
2535
with:
26-
node-version: 16
36+
node-version: 18
2737
- uses: pnpm/[email protected]
2838
name: Install pnpm
2939
id: pnpm-install
3040
with:
31-
version: 7
41+
version: 8
3242
run_install: false
3343
- name: Get pnpm store directory
3444
id: pnpm-cache
@@ -102,4 +112,27 @@ jobs:
102112
release_id: releaseId,
103113
name: artifactName,
104114
data: await fs.readFile(artifactPathName)
105-
});
115+
});
116+
117+
app-store-release:
118+
runs-on: ubuntu-latest
119+
needs: build
120+
if: github.event_name == 'release'
121+
steps:
122+
- uses: actions/checkout@v3
123+
with:
124+
submodules: true
125+
- name: Download plugin-umami jar
126+
uses: actions/download-artifact@v2
127+
with:
128+
name: plugin-umami
129+
path: build/libs
130+
- name: Sync to Halo App Store
131+
uses: halo-sigs/app-store-release-action@main
132+
with:
133+
github-token: ${{secrets.GITHUB_TOKEN}}
134+
app-id: ${{secrets.APP_ID}}
135+
release-id: ${{ github.event.release.id }}
136+
assets-dir: "build/libs"
137+
halo-username: ${{ secrets.HALO_USERNAME }}
138+
halo-password: ${{ secrets.HALO_PASSWORD }}

build.gradle

+10-31
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,39 @@
11
plugins {
2-
id "com.github.node-gradle.node" version "3.3.0"
3-
id "io.github.guqing.plugin-development" version "0.0.5-SNAPSHOT"
2+
id "com.github.node-gradle.node" version "5.0.0"
3+
id "run.halo.plugin.devtools" version "0.0.5"
4+
id "io.freefair.lombok" version "8.0.1"
45
id 'java'
56
}
67

78
group 'run.halo.umami'
89
sourceCompatibility = JavaVersion.VERSION_17
910

1011
repositories {
11-
maven { url 'https://repo.spring.io/milestone' }
12+
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
1213
mavenCentral()
1314
}
1415

15-
jar {
16-
enabled = true
17-
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
18-
manifest.attributes(
19-
'Plugin-Version': "${project.version}",
20-
)
21-
from {
22-
configurations.runtimeClasspath.collect {
23-
it.isDirectory() ? it : zipTree(it)
24-
}
25-
}
26-
}
27-
2816
dependencies {
29-
compileOnly platform('run.halo.dependencies:halo-dependencies:1.0.0')
30-
compileOnly files("lib/halo-2.0.0-plain.jar")
31-
compileOnly 'org.projectlombok:lombok'
32-
annotationProcessor 'org.projectlombok:lombok:1.18.22'
17+
implementation platform('run.halo.tools.platform:plugin:2.8.0-SNAPSHOT')
18+
compileOnly 'run.halo.app:api'
3319

34-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
35-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
20+
testImplementation 'run.halo.app:api'
21+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
3622
}
3723

3824
test {
3925
useJUnitPlatform()
4026
}
4127

4228
node {
29+
pnpmVersion = '8'
4330
nodeProjectDir = file("${project.projectDir}/console")
4431
}
4532

46-
task buildFrontend(type: NpxTask) {
47-
command = 'pnpm@7'
33+
task buildFrontend(type: PnpmTask) {
4834
args = ['build']
4935
}
5036

51-
task pnpmInstall(type: NpxTask) {
52-
command = "pnpm@7"
53-
args = ["install"]
54-
}
55-
5637
build {
57-
// build frontend before build
5838
tasks.getByName('compileJava').dependsOn('buildFrontend')
59-
tasks.getByName("buildFrontend").dependsOn("pnpmInstall")
6039
}

console/.env

-1
This file was deleted.

console/.eslintrc.cjs

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
require("@rushstack/eslint-patch/modern-module-resolution");
33

44
module.exports = {
5-
"root": true,
6-
"extends": [
7-
"plugin:vue/vue3-essential",
5+
root: true,
6+
extends: [
7+
"plugin:vue/vue3-recommended",
88
"eslint:recommended",
99
"@vue/eslint-config-typescript/recommended",
10-
"@vue/eslint-config-prettier"
10+
"@vue/eslint-config-prettier",
1111
],
12-
"env": {
13-
"vue/setup-compiler-macros": true
14-
}
15-
}
12+
env: {
13+
"vue/setup-compiler-macros": true,
14+
},
15+
};

console/env.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="vite/client" />
2+
/// <reference types="unplugin-icons/types/vue" />
23

34
declare module "*.vue" {
45
import Vue from "vue";

console/package.json

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"name": "@halo-dev/plugin-umami",
3-
"version": "0.0.0",
4-
"private": true,
52
"scripts": {
63
"dev": "vite build --watch",
74
"build": "vite build",
@@ -11,33 +8,34 @@
118
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
129
},
1310
"dependencies": {
14-
"@halo-dev/components": "^1.0.0",
15-
"@halo-dev/console-shared": "^2.0.0",
16-
"axios": "^1.1.3",
17-
"vue": "^3.2.41",
18-
"vue-router": "^4.1.6"
11+
"@halo-dev/api-client": "^2.8.0",
12+
"@halo-dev/components": "^1.7.0",
13+
"@halo-dev/console-shared": "^2.8.0",
14+
"axios": "^1.4.0",
15+
"vue": "^3.3.4",
16+
"vue-router": "^4.2.4"
1917
},
2018
"devDependencies": {
21-
"@iconify/json": "^2.1.128",
22-
"@rushstack/eslint-patch": "^1.2.0",
19+
"@iconify/json": "^2.2.104",
20+
"@rushstack/eslint-patch": "^1.3.3",
21+
"@tsconfig/node18": "^18.2.1",
2322
"@types/jsdom": "^16.2.15",
24-
"@types/node": "^16.18.0",
25-
"@vitejs/plugin-vue": "^2.3.4",
26-
"@vitejs/plugin-vue-jsx": "^1.3.10",
27-
"@vue/compiler-sfc": "^3.2.45",
28-
"@vue/eslint-config-prettier": "^7.0.0",
23+
"@types/node": "^16.18.41",
24+
"@vitejs/plugin-vue": "^4.3.3",
25+
"@vue/compiler-sfc": "^3.3.4",
26+
"@vue/eslint-config-prettier": "^7.1.0",
2927
"@vue/eslint-config-typescript": "^10.0.0",
30-
"@vue/test-utils": "^2.2.0",
31-
"@vue/tsconfig": "^0.1.3",
32-
"eslint": "^8.26.0",
28+
"@vue/test-utils": "^2.4.1",
29+
"@vue/tsconfig": "^0.4.0",
30+
"eslint": "^8.47.0",
3331
"eslint-plugin-vue": "^8.7.1",
3432
"jsdom": "^19.0.0",
3533
"npm-run-all": "^4.1.5",
36-
"prettier": "^2.7.1",
37-
"typescript": "~4.7.4",
38-
"unplugin-icons": "^0.14.12",
39-
"vite": "^2.9.15",
34+
"prettier": "^2.8.8",
35+
"typescript": "~5.0.4",
36+
"unplugin-icons": "^0.14.15",
37+
"vite": "^4.4.9",
4038
"vitest": "^0.13.1",
41-
"vue-tsc": "^0.35.2"
39+
"vue-tsc": "^1.8.8"
4240
}
4341
}

0 commit comments

Comments
 (0)