Skip to content

Commit c4fc6a9

Browse files
committed
fix(ci): use pnpm exec to run napi CLI from package context
The napi CLI is a devDependency, not globally available. Use `pnpm --filter=vite-plus exec napi` to run it from the package context.
1 parent c2e7fd7 commit c4fc6a9

8 files changed

Lines changed: 68 additions & 47 deletions

File tree

.cargo/config.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ rustflags = ["--cfg", "tokio_unstable"] # also update .github/workflows/ci.yml
88
[target.'cfg(target_os = "linux")']
99
rustflags = ["--cfg", "tokio_unstable", "-C", "link-args=-Wl,--warn-unresolved-symbols"]
1010

11-
# Required for aarch64-linux-gnu-gcc linker on Ubuntu x86_64
12-
[target.aarch64-unknown-linux-gnu]
13-
linker = "aarch64-linux-gnu-gcc"
14-
1511
[unstable]
1612
bindeps = true
1713

.github/actions/build-upstream/action.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ runs:
5353
5454
# NAPI builds - only run on cache miss (slow, especially on Windows)
5555
# Must run before vite-plus/vite-plus-cli TypeScript builds which depend on the bindings
56-
- name: Build NAPI bindings
56+
- name: Build NAPI bindings (x86_64-linux)
5757
shell: bash
5858
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
5959
run: |
@@ -63,17 +63,18 @@ runs:
6363
TARGET_CC: clang
6464
DEBUG: napi:*
6565

66-
- name: Build NAPI bindings
66+
- name: Build NAPI bindings (aarch64-linux)
6767
shell: bash
6868
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
6969
run: |
70-
TARGET_CFLAGS="-D_BSD_SOURCE" pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
71-
TARGET_CFLAGS="-D_BSD_SOURCE" pnpm --filter=vite-plus-cli build-native --target ${{ inputs.target }} --use-napi-cross
70+
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
71+
pnpm --filter=vite-plus-cli build-native --target ${{ inputs.target }} --use-napi-cross
7272
env:
7373
TARGET_CC: clang
74+
TARGET_CFLAGS: '-D_BSD_SOURCE'
7475
DEBUG: napi:*
7576

76-
- name: Build NAPI bindings
77+
- name: Build NAPI bindings (non-Linux targets)
7778
shell: bash
7879
if: steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
7980
run: |
@@ -82,32 +83,27 @@ runs:
8283
env:
8384
DEBUG: napi:*
8485

85-
- name: Build Rust CLI binary (Linux gnu targets)
86-
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux-gnu')
86+
- name: Build Rust CLI binary (x86_64-linux)
87+
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
8788
shell: bash
88-
run: pnpm napi build --use-napi-cross --bin vp --target ${{ inputs.target }} --release -p vite_global_cli
89+
run: |
90+
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
8991
env:
9092
TARGET_CC: clang
9193
DEBUG: napi:*
9294

93-
- name: Verify glibc version (x86_64-linux)
94-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
95+
- name: Build Rust CLI binary (aarch64-linux)
96+
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
9597
shell: bash
9698
run: |
97-
echo "Checking glibc version requirements for vp binary..."
98-
GLIBC_VERSIONS=$(objdump -T target/x86_64-unknown-linux-gnu/release/vp | grep GLIBC | sed 's/.*GLIBC_//' | cut -d' ' -f1 | sort -V | uniq)
99-
echo "Required glibc versions: $GLIBC_VERSIONS"
100-
# Verify no glibc version higher than 2.17 is required
101-
if echo "$GLIBC_VERSIONS" | grep -E '^2\.(1[8-9]|[2-9][0-9]|[0-9]{3,})$'; then
102-
echo "ERROR: Binary requires glibc > 2.17, which breaks compatibility with older Linux distributions"
103-
echo "Full glibc symbol list:"
104-
objdump -T target/x86_64-unknown-linux-gnu/release/vp | grep GLIBC
105-
exit 1
106-
fi
107-
echo "OK: Binary is compatible with glibc 2.17+"
99+
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
100+
env:
101+
TARGET_CC: clang
102+
TARGET_CFLAGS: '-D_BSD_SOURCE'
103+
DEBUG: napi:*
108104

109105
- name: Build Rust CLI binary (non-Linux targets)
110-
if: steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux-gnu')
106+
if: steps.cache-restore.outputs.cache-hit != 'true' && !contains(inputs.target, 'linux')
111107
shell: bash
112108
run: cargo build --release --target ${{ inputs.target }} -p vite_global_cli
113109

.github/workflows/test-install.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,19 @@ jobs:
4343
run: bash packages/global/install.sh
4444

4545
- name: Verify installation
46+
working-directory: ${{ runner.temp }}
4647
run: |
4748
# Source shell config to get PATH updated
48-
source ~/.zshrc 2>/dev/null || source ~/.bashrc 2>/dev/null || true
49-
# Also check if symlink was created in ~/.local/bin
50-
export PATH="$HOME/.local/bin:$HOME/.vite-plus/current/bin:$PATH"
49+
if [ -f ~/.zshrc ]; then
50+
source ~/.zshrc
51+
elif [ -f ~/.bashrc ]; then
52+
source ~/.bashrc
53+
fi
5154
vp --version
5255
vp --help
56+
# test new command
57+
vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
58+
cd hello && vp run build
5359
5460
test-install-sh-arm64:
5561
name: Test install.sh (Linux ARM64 glibc via QEMU)
@@ -75,6 +81,11 @@ jobs:
7581
export PATH=\"\$HOME/.local/bin:\$HOME/.vite-plus/current/bin:\$PATH\"
7682
vp --version
7783
vp --help
84+
vp dlx print-current-version
85+
export VITE_LOG=trace
86+
# FIXME: qemu: uncaught target signal 11 (Segmentation fault) - core dumped
87+
# vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
88+
# cd hello && vp run build
7889
"
7990
8091
test-install-ps1:
@@ -94,8 +105,13 @@ jobs:
94105
95106
- name: Verify installation
96107
shell: pwsh
108+
working-directory: ${{ runner.temp }}
97109
run: |
98110
# Refresh PATH from environment
99111
$env:Path = "$env:USERPROFILE\.vite-plus\current\bin;$env:Path"
100112
vp --version
101113
vp --help
114+
# $env:VITE_LOG = "trace"
115+
# test new command
116+
vp new create-vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
117+
cd hello && vp run build

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"prepare": "husky"
2222
},
2323
"devDependencies": {
24+
"@napi-rs/cli": "catalog:",
2425
"@oxc-node/cli": "catalog:",
2526
"@oxc-node/core": "catalog:",
2627
"@types/node": "catalog:",

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
"oxlint-tsgolint": "catalog:"
301301
},
302302
"devDependencies": {
303-
"@napi-rs/cli": "^3.4.1",
303+
"@napi-rs/cli": "catalog:",
304304
"@oxc-node/core": "^0.0.32",
305305
"@voidzero-dev/vite-plus-tools": "workspace:",
306306
"rolldown": "workspace:*",

packages/global/src/new/bin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ Use \`vp new --list\` to list all available templates, or run \`vp new --help\`
436436
prompts.outro(`✔ Created ${accent(projectDir)}!`);
437437
log(`${styleText('bold', 'Next steps:')}`);
438438
log(` ${accent(`cd ${projectDir}`)}`);
439-
log(` ${accent(`vite dev ${InitialMonorepoAppDir}`)}`);
439+
log(` ${accent(`vp dev ${InitialMonorepoAppDir}`)}`);
440440
return;
441441
}
442442
// #endregion
@@ -532,7 +532,7 @@ Use \`vp new --list\` to list all available templates, or run \`vp new --help\`
532532
}
533533

534534
if (selectedDeps.length > 0) {
535-
// FIXME: should use `vite add` command instead
535+
// FIXME: should use `vp add` command instead
536536
updatePackageJsonWithDeps(
537537
workspaceInfo.rootDir,
538538
projectDir,
@@ -560,10 +560,10 @@ Use \`vp new --list\` to list all available templates, or run \`vp new --help\`
560560
function showNextSteps(projectDir: string, isMonorepo: boolean) {
561561
log(`${styleText('bold', 'Next steps:')}`);
562562
if (isMonorepo) {
563-
log(` ${accent(`vite dev ${projectDir}`)}`);
563+
log(` ${accent(`vp dev ${projectDir}`)}`);
564564
} else {
565565
log(` ${accent(`cd ${projectDir}`)}`);
566-
log(` ${accent('vite dev')}`);
566+
log(` ${accent('vp dev')}`);
567567
}
568568
log('');
569569
}

pnpm-lock.yaml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ packages:
55
- rolldown/packages/*
66
- rolldown-vite
77
- rolldown-vite/packages/*
8+
89
catalog:
910
'@babel/core': ^7.24.7
1011
'@babel/preset-env': ^7.24.7
@@ -14,13 +15,13 @@ catalog:
1415
'@napi-rs/wasm-runtime': ^1.0.0
1516
'@oxc-node/cli': ^0.0.35
1617
'@oxc-node/core': ^0.0.35
17-
'@oxc-project/runtime': =0.111.0
18-
'@oxc-project/types': =0.111.0
18+
'@oxc-project/runtime': '=0.111.0'
19+
'@oxc-project/types': '=0.111.0'
1920
'@pnpm/find-workspace-packages': ^6.0.9
2021
'@rollup/plugin-commonjs': ^29.0.0
2122
'@rollup/plugin-json': ^6.1.0
2223
'@rollup/plugin-node-resolve': ^16.0.0
23-
'@std/yaml': 'npm:@jsr/std__yaml@^1.0.10'
24+
'@std/yaml': npm:@jsr/std__yaml@^1.0.10
2425
'@types/babel__core': 7.20.5
2526
'@types/connect': ^3.4.38
2627
'@types/cross-spawn': ^6.0.6
@@ -75,9 +76,9 @@ catalog:
7576
mocha: ^11.7.5
7677
mri: ^1.2.0
7778
next: ^15.4.3
78-
oxc-minify: =0.111.0
79-
oxc-parser: =0.111.0
80-
oxc-transform: =0.111.0
79+
oxc-minify: '=0.111.0'
80+
oxc-parser: '=0.111.0'
81+
oxc-transform: '=0.111.0'
8182
oxfmt: ^0.27.0
8283
oxlint: ^1.42.0
8384
oxlint-tsgolint: ^0.11.3
@@ -117,9 +118,13 @@ catalog:
117118
yaml: ^2.8.1
118119
zod: ^4.3.5
119120
zx: ^8.1.2
121+
120122
catalogMode: prefer
123+
121124
ignoreScripts: true
125+
122126
minimumReleaseAge: 1440
127+
123128
minimumReleaseAgeExclude:
124129
- '@napi-rs/*'
125130
- '@oxc-project/*'
@@ -148,24 +153,28 @@ minimumReleaseAgeExclude:
148153
- vitepress
149154
- vitest
150155
- unrun
156+
151157
overrides:
152-
'@rolldown/pluginutils': 'workspace:@rolldown/pluginutils@*'
153-
rolldown: 'workspace:rolldown@*'
154-
vite: 'workspace:@voidzero-dev/vite-plus-core@*'
155-
vitest: 'workspace:@voidzero-dev/vite-plus-test@*'
156-
vitest-dev: 'npm:vitest@^4.0.18'
158+
'@rolldown/pluginutils': workspace:@rolldown/pluginutils@*
159+
rolldown: workspace:rolldown@*
160+
vite: workspace:@voidzero-dev/vite-plus-core@*
161+
vitest: workspace:@voidzero-dev/vite-plus-test@*
162+
vitest-dev: npm:vitest@^4.0.18
163+
157164
packageExtensions:
158165
sass-embedded:
159166
peerDependencies:
160167
source-map-js: '*'
161168
peerDependenciesMeta:
162169
source-map-js:
163170
optional: true
171+
164172
patchedDependencies:
165-
sirv@3.0.2: rolldown-vite/patches/sirv@3.0.2.patch
166173
chokidar@3.6.0: rolldown-vite/patches/chokidar@3.6.0.patch
167174
dotenv-expand@12.0.3: rolldown-vite/patches/dotenv-expand@12.0.3.patch
168175
http-proxy-3: rolldown-vite/patches/http-proxy-3.patch
176+
sirv@3.0.2: rolldown-vite/patches/sirv@3.0.2.patch
177+
169178
peerDependencyRules:
170179
allowAny:
171180
- vite

0 commit comments

Comments
 (0)