Skip to content

Commit 373b94f

Browse files
authored
style: Add oxfmt and apply formatting (#77)
1 parent 0a8a7aa commit 373b94f

22 files changed

Lines changed: 652 additions & 149 deletions

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ charset = utf-8
33
end_of_line = lf
44
indent_size = 4
55
indent_style = space
6-
insert_final_newline = false
6+
insert_final_newline = true
77
max_line_length = 120
88
tab_width = 4
99
ij_continuation_indent_size = 8

.github/workflows/build-and-release.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,31 @@ jobs:
6262
uses: gradle/actions/setup-gradle@v6
6363
with:
6464
cache-read-only: false
65-
- uses: pnpm/action-setup@v5
65+
- if: matrix.id != 'lite'
66+
uses: pnpm/action-setup@v5
6667
name: Install pnpm
6768
id: pnpm-install
6869
with:
6970
version: 10.22.0
7071
run_install: false
71-
- name: Resolve pnpm cache dependency paths
72+
- if: matrix.id != 'lite'
73+
name: Resolve pnpm cache dependency paths
7274
id: pnpm-cache-paths
7375
shell: bash
7476
run: |
7577
{
7678
echo 'paths<<EOF'
77-
echo 'ui/pnpm-lock.yaml'
78-
if [ -f js-modules/shiki/pnpm-lock.yaml ]; then
79-
echo 'js-modules/shiki/pnpm-lock.yaml'
80-
fi
79+
# 新增独立的前端子模块时,记得把对应的 pnpm-lock.yaml 一并加入这里。
80+
echo 'js-modules/shiki/pnpm-lock.yaml'
8181
echo 'EOF'
8282
} >> "$GITHUB_OUTPUT"
83-
- name: Set up Node.js
83+
- if: matrix.id != 'lite'
84+
name: Set up Node.js
8485
uses: actions/setup-node@v6
8586
with:
8687
node-version: 25
8788
cache: 'pnpm'
88-
# 新增独立的前端子模块时,记得把对应的 pnpm-lock.yaml 一并加入这里。
89-
# 先过滤掉不存在的路径,避免 lite 变体或精简仓库缺少子模块时缓存步骤报错。
89+
# 仅为当前会实际触发 pnpm 的变体提供缓存依赖路径。
9090
cache-dependency-path: ${{ steps.pnpm-cache-paths.outputs.paths }}
9191
- name: Make gradlew executable
9292
run: chmod +x ./gradlew

.github/workflows/ci-test.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,14 @@ jobs:
3535
run: |
3636
{
3737
echo 'paths<<EOF'
38-
echo 'ui/pnpm-lock.yaml'
39-
if [ -f js-modules/shiki/pnpm-lock.yaml ]; then
40-
echo 'js-modules/shiki/pnpm-lock.yaml'
41-
fi
38+
echo 'js-modules/shiki/pnpm-lock.yaml'
4239
echo 'EOF'
4340
} >> "$GITHUB_OUTPUT"
4441
- name: Set up Node.js
4542
uses: actions/setup-node@v6
4643
with:
4744
node-version: 25
4845
cache: 'pnpm'
49-
# 新增独立的前端子模块时,记得把对应的 pnpm-lock.yaml 一并加入这里。
50-
# 先过滤掉不存在的路径,避免 lite 变体或精简仓库缺少子模块时缓存步骤报错。
5146
cache-dependency-path: ${{ steps.pnpm-cache-paths.outputs.paths }}
5247
- name: Make gradlew executable
5348
run: chmod +x ./gradlew

js-modules/shiki/.oxfmtrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["src/assets/**"],
4+
"overrides": [
5+
{
6+
"files": ["**/*.jsonc"],
7+
"options": {
8+
"trailingComma": "none"
9+
}
10+
}
11+
],
12+
"sortImports": {},
13+
"sortPackageJson": {
14+
"sortScripts": true
15+
}
16+
}

js-modules/shiki/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
{
22
"name": "shiki",
3-
"private": true,
43
"version": "0.0.0",
4+
"private": true,
55
"type": "module",
66
"scripts": {
7-
"dev": "vite",
87
"build": "vite build",
9-
"prebuild": "pnpm run generate-config",
8+
"dev": "vite",
9+
"fmt": "pnpm run \"/^fmt:.*/\"",
10+
"fmt:oxfmt": "oxfmt \"**/*.{json,jsonc,yaml,md,css,js,ts,html,vue,less}\"",
1011
"generate-config": "node ./scripts/generate-config.js",
12+
"prebuild": "pnpm run generate-config",
1113
"preview": "vite preview"
1214
},
15+
"dependencies": {
16+
"shiki": "^4.0.2"
17+
},
1318
"devDependencies": {
1419
"js-yaml": "^4.1.1",
20+
"oxfmt": "^0.42.0",
1521
"vite": "8.0.3"
1622
},
17-
"dependencies": {
18-
"shiki": "^4.0.2"
19-
},
2023
"engines": {
2124
"node": ">=25",
2225
"pnpm": "^10.33.0"

0 commit comments

Comments
 (0)