Skip to content

Commit 80b52ad

Browse files
authored
Merge pull request #69 from taptap:feat/cloud-save
feat(ci): add Linux ARM64 and fix macOS Intel build
2 parents fcdac61 + 862413f commit 80b52ad

3 files changed

Lines changed: 30 additions & 17 deletions

File tree

.github/workflows/build-native.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
settings:
35-
# macOS
36-
- host: macos-latest
35+
# macOS Intel (x64)
36+
- host: macos-13
3737
target: x86_64-apple-darwin
3838
artifact: taptap-signer.darwin-x64.node
3939
build: |
4040
cd native
4141
npm run build
4242
strip -x *.node
4343
44+
# macOS Apple Silicon (ARM64)
4445
- host: macos-latest
4546
target: aarch64-apple-darwin
4647
artifact: taptap-signer.darwin-arm64.node

.github/workflows/release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ jobs:
7777
fail-fast: false
7878
matrix:
7979
settings:
80-
# macOS
81-
- host: macos-latest
80+
# macOS Intel (x64)
81+
- host: macos-13
8282
target: x86_64-apple-darwin
8383
build: |
8484
cd native
8585
npm run build
8686
strip -x *.node
8787
88+
# macOS Apple Silicon (ARM64)
8889
- host: macos-latest
8990
target: aarch64-apple-darwin
9091
build: |
@@ -102,7 +103,7 @@ jobs:
102103
npm run build -- --target x86_64-unknown-linux-gnu
103104
strip *.node
104105
105-
# Linux Musl (Alpine)
106+
# Linux Musl x64 (Alpine)
106107
- host: ubuntu-latest
107108
target: x86_64-unknown-linux-musl
108109
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
@@ -112,6 +113,16 @@ jobs:
112113
npm run build -- --target x86_64-unknown-linux-musl
113114
strip *.node
114115
116+
# Linux Musl ARM64 (Alpine on ARM servers / Apple Silicon Docker)
117+
- host: ubuntu-latest
118+
target: aarch64-unknown-linux-musl
119+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
120+
build: |
121+
rustup update stable && rustup default stable
122+
cd native
123+
npm run build -- --target aarch64-unknown-linux-musl
124+
strip *.node
125+
115126
# Windows
116127
- host: windows-latest
117128
target: x86_64-pc-windows-msvc

src/core/utils/pathResolver.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ export function resolveWorkPath(relativePath?: string, ctx?: ResolvedContext): s
129129

130130
// 2. 如果有 Proxy 注入的 projectPath
131131
if (ctx?.projectPath) {
132-
// 如果 projectPath 是绝对路径,直接使用
133-
// 如果是相对路径,拼接到 WORKSPACE_ROOT
134-
if (path.isAbsolute(ctx.projectPath)) {
135-
basePath = ctx.projectPath;
136-
} else {
137-
basePath = path.join(WORKSPACE_ROOT, ctx.projectPath);
138-
}
132+
// 设计:projectPath 总是相对于 WORKSPACE_ROOT
133+
// 即使以 '/' 开头也视为相对路径(去掉开头的 '/')
134+
// 例如:"/a51c239e.../workspace" -> "a51c239e.../workspace"
135+
const normalizedProjectPath = ctx.projectPath.startsWith('/')
136+
? ctx.projectPath.slice(1)
137+
: ctx.projectPath;
138+
basePath = path.join(WORKSPACE_ROOT, normalizedProjectPath);
139139
}
140140

141141
// 3. 拼接用户传入的相对路径
@@ -255,11 +255,12 @@ export function resolvePathSafe(
255255
// 1. 计算基础路径
256256
let basePath = WORKSPACE_ROOT;
257257
if (ctx?.projectPath) {
258-
if (path.isAbsolute(ctx.projectPath)) {
259-
basePath = ctx.projectPath;
260-
} else {
261-
basePath = path.join(WORKSPACE_ROOT, ctx.projectPath);
262-
}
258+
// 设计:projectPath 总是相对于 WORKSPACE_ROOT
259+
// 即使以 '/' 开头也视为相对路径(去掉开头的 '/')
260+
const normalizedProjectPath = ctx.projectPath.startsWith('/')
261+
? ctx.projectPath.slice(1)
262+
: ctx.projectPath;
263+
basePath = path.join(WORKSPACE_ROOT, normalizedProjectPath);
263264
}
264265

265266
// 2. 处理空字符串或未传的情况

0 commit comments

Comments
 (0)