Skip to content

Commit ed0b95b

Browse files
committed
fix: align Vite+ commands and CI runtime
- switch local scripts and developer docs to direct vp commands - pin setup-vp workflows to .node-version for Node 24 consistency - clean up lint warnings and regenerate dist artifacts
1 parent 1ca674d commit ed0b95b

13 files changed

Lines changed: 77 additions & 43 deletions

File tree

.github/workflows/_test-container.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
uses: voidzero-dev/setup-vp@v1
8484
with:
8585
cache: true
86+
node-version-file: .node-version
8687

8788
- name: Build
8889
run: vp pack

.github/workflows/_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
uses: voidzero-dev/setup-vp@v1
4646
with:
4747
cache: true
48+
node-version-file: .node-version
4849

4950
- name: Build
5051
run: vp pack

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
uses: voidzero-dev/setup-vp@v1
2222
with:
2323
cache: true
24+
node-version-file: .node-version
2425

2526
- name: Check Format, Lint and TypeCheck
2627
run: vp check

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
uses: voidzero-dev/setup-vp@v1
2626
with:
2727
cache: true
28+
node-version-file: .node-version
2829

2930
- name: Build
3031
run: vp pack

dist/index.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17362,6 +17362,15 @@ function debugLog(message) {
1736217362
debug(message);
1736317363
}
1736417364
/**
17365+
* Convert an unknown thrown value into a readable error message.
17366+
* @param error - Value thrown by a catch clause
17367+
* @returns Error message string
17368+
*/
17369+
function getErrorMessage(error) {
17370+
if (error instanceof Error) return error.message;
17371+
return String(error);
17372+
}
17373+
/**
1736517374
* Check if the current process has root/administrator privileges
1736617375
* @returns true if running with root/admin privileges, false otherwise
1736717376
*/
@@ -17593,7 +17602,7 @@ async function getCudaLocalInstallerUrl(version, os, arch) {
1759317602
let pattern;
1759417603
if (arch === Arch.X86_64) pattern = new RegExp(`cuda_${version.replace(/\./g, "\\.")}_\\d+\\.\\d+(\\.\\d+)?_linux\\.run`);
1759517604
else if (arch === Arch.ARM64_SBSA) pattern = new RegExp(`cuda_${version.replace(/\./g, "\\.")}_\\d+\\.\\d+(\\.\\d+)?_linux_sbsa\\.run`);
17596-
else throw new Error(`Unsupported architecture: ${arch}`);
17605+
else throw new Error(`Unsupported architecture: ${String(arch)}`);
1759717606
for (const [filename] of Object.entries(md5sums)) if (filename.match(pattern)) {
1759817607
targetFilename = filename;
1759917608
break;
@@ -17698,7 +17707,7 @@ function buildCudaRepoUrl(targetOsName, arch) {
1769817707
let cudaRepoUrl = `https://developer.download.nvidia.com/compute/cuda/repos/${targetOsName}`;
1769917708
if (arch === Arch.X86_64) cudaRepoUrl += "/x86_64/";
1770017709
else if (arch === Arch.ARM64_SBSA) cudaRepoUrl += "/sbsa/";
17701-
else throw new Error(`Unsupported architecture: ${arch}`);
17710+
else throw new Error(`Unsupported architecture: ${String(arch)}`);
1770217711
return cudaRepoUrl;
1770317712
}
1770417713
/**
@@ -19411,7 +19420,7 @@ async function installCudaLinuxNetwork(version, arch, osInfo) {
1941119420
try {
1941219421
repoFilePath = await downloadTool(repoUrl);
1941319422
} catch (error) {
19414-
throw new Error(`Failed to download CUDA repository file from ${repoUrl}: ${error}`);
19423+
throw new Error(`Failed to download CUDA repository file from ${repoUrl}: ${getErrorMessage(error)}`);
1941519424
}
1941619425
repoFilePath = path.resolve(repoFilePath);
1941719426
if (repoUrl.endsWith(".deb")) {
@@ -19432,7 +19441,7 @@ async function installCudaLinuxNetwork(version, arch, osInfo) {
1943219441
cudaPath = "/usr/local/cuda";
1943319442
}
1943419443
} catch (error) {
19435-
throw new Error(`Failed to install CUDA via network: ${error}`);
19444+
throw new Error(`Failed to install CUDA via network: ${getErrorMessage(error)}`);
1943619445
}
1943719446
return cudaPath;
1943819447
}
@@ -19451,7 +19460,7 @@ async function installCudaWindowsNetwork(version) {
1945119460
try {
1945219461
installerPath = await downloadTool(networkInstallerUrl, getWindowsInstallerDownloadPath(filename));
1945319462
} catch (error) {
19454-
throw new Error(`Failed to download CUDA network installer from ${networkInstallerUrl}: ${error} for version ${version}`);
19463+
throw new Error(`Failed to download CUDA network installer from ${networkInstallerUrl}: ${getErrorMessage(error)} for version ${version}`);
1945519464
}
1945619465
installerPath = normalizeInstallerPath(installerPath, OS.WINDOWS);
1945719466
const installArgs = ["-s"];
@@ -19461,7 +19470,7 @@ async function installCudaWindowsNetwork(version) {
1946119470
try {
1946219471
await exec(command, installArgs);
1946319472
} catch (error) {
19464-
throw new Error(`Failed to execute CUDA installer: ${error}`);
19473+
throw new Error(`Failed to execute CUDA installer: ${getErrorMessage(error)}`);
1946519474
}
1946619475
await rmRF(installerPath);
1946719476
const cudaPath = `C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${version.split(".").slice(0, 2).join(".")}`;
@@ -19524,7 +19533,7 @@ async function run() {
1952419533
} else if (inputMethod === "auto") try {
1952519534
cudaPath = await installCudaNetwork(targetCudaVersion, osType, arch, osType === OS.LINUX ? linuxDistribution : windowsVersion);
1952619535
} catch (error) {
19527-
info(`CUDA network installation failed for version ${targetCudaVersion}: ${error}`);
19536+
info(`CUDA network installation failed for version ${targetCudaVersion}: ${getErrorMessage(error)}`);
1952819537
info("Falling back to local installation");
1952919538
cudaPath = await installCudaLocal(targetCudaVersion, osType, arch);
1953019539
}

dist/index.js.map

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

docs/dev.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
## Prerequisites
44

55
- Node.js >= 24.0.0
6-
- pnpm (version specified in package.json: 10.18.3)
6+
- Vite+ (`vp`) installed globally
77

88
## Setup
99

1010
Install dependencies:
1111

1212
```bash
13-
pnpm install
13+
vp install
1414
```
1515

1616
## Development Workflow
@@ -36,22 +36,25 @@ After making code changes, run the following commands locally:
3636

3737
```bash
3838
# Format code
39-
pnpm run format
39+
vp fmt src test
4040

41-
# Lint
42-
pnpm run lint:fix
41+
# Lint and apply autofixes
42+
vp lint src test --fix
4343

4444
# Type check
45-
pnpm run typecheck
45+
tsc --noEmit
46+
47+
# Run format, lint, and type-aware checks together
48+
vp check
4649

4750
# Run tests
48-
pnpm run test
51+
vp test run
4952

5053
# Build
51-
pnpm run build
54+
vp pack
5255

53-
# Or run all at once
54-
pnpm run all
56+
# Or run the full local verification flow
57+
vp check && tsc --noEmit && vp test run && vp pack
5558
```
5659

5760
**Important**: Always commit the `dist/` directory after building. The built files must be committed because GitHub Actions runs the action from the repository directly.
@@ -94,10 +97,8 @@ Runs on:
9497
Jobs:
9598

9699
1. **Format-Lint-TypeCheck**
97-
- Checks code formatting with Prettier
98-
- Lints code with ESLint
99-
- Type checks with TypeScript
100-
- Runs unit tests with Vitest
100+
- Runs `vp check` for formatting, lint, and type-aware checks
101+
- Runs unit tests with `vp test run`
101102

102103
2. **Test**
103104
- Tests the action on multiple platforms:
@@ -141,7 +142,7 @@ Tests on container environments:
141142
Before creating a release, make sure the `dist/` directory is built and committed:
142143

143144
```bash
144-
pnpm run build
145+
vp pack
145146
git add dist/
146147
git commit -m "build: update dist for release"
147148
git push
@@ -161,7 +162,7 @@ git push origin v1.2.3
161162
When a tag matching `v[0-9]+.[0-9]+.[0-9]+` is pushed, the release workflow (`.github/workflows/release.yml`) automatically:
162163

163164
1. Checks out the code
164-
2. Installs dependencies
165+
2. Sets up `vp` and installs dependencies
165166
3. Builds the project
166167
4. Verifies that `dist/` is up-to-date (fails if uncommitted changes exist)
167168
5. Creates a GitHub release with auto-generated release notes
@@ -178,13 +179,13 @@ Example:
178179

179180
```bash
180181
# Run tests once
181-
pnpm run test
182+
vp test run
182183

183184
# Run tests in watch mode
184-
pnpm run test:watch
185+
vp test
185186

186187
# Run tests with coverage
187-
pnpm run test:coverage
188+
vp test run --coverage
188189
```
189190

190191
### Integration Test

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
"main": "dist/index.js",
66
"scripts": {
77
"build": "vp pack",
8-
"format": "vp fmt 'src/**/*.ts'",
9-
"format:check": "vp fmt --check 'src/**/*.ts'",
10-
"lint": "vp lint src/**/*.ts",
11-
"lint:fix": "vp lint src/**/*.ts --fix",
8+
"format": "vp fmt src test",
9+
"format:check": "vp fmt --check src test",
10+
"lint": "vp lint src test",
11+
"lint:fix": "vp lint src test --fix",
1212
"typecheck": "tsc --noEmit",
13+
"check": "vp check",
14+
"check:fix": "vp check --fix",
1315
"test": "vp test run",
1416
"test:watch": "vp test",
1517
"test:coverage": "vp test run --coverage",
16-
"all": "pnpm format && pnpm lint && pnpm typecheck && pnpm test && pnpm build",
18+
"all": "vp check && tsc --noEmit && vp test run && vp pack",
1719
"prepare": "vp config"
1820
},
1921
"keywords": [

src/cuda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export async function getCudaLocalInstallerUrl(
311311
`cuda_${version.replace(/\./g, '\\.')}_\\d+\\.\\d+(\\.\\d+)?_linux_sbsa\\.run`
312312
);
313313
} else {
314-
throw new Error(`Unsupported architecture: ${arch}`);
314+
throw new Error(`Unsupported architecture: ${String(arch)}`);
315315
}
316316

317317
for (const [filename] of Object.entries(md5sums)) {
@@ -491,7 +491,7 @@ function buildCudaRepoUrl(targetOsName: string, arch: Arch): string {
491491
} else if (arch === Arch.ARM64_SBSA) {
492492
cudaRepoUrl += '/sbsa/';
493493
} else {
494-
throw new Error(`Unsupported architecture: ${arch}`);
494+
throw new Error(`Unsupported architecture: ${String(arch)}`);
495495
}
496496

497497
return cudaRepoUrl;

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from './os_arch';
1313
import { findCudaVersion } from './cuda';
1414
import { installCudaLocal, installCudaNetwork } from './install';
15+
import { getErrorMessage } from './utils';
1516

1617
function setEnvironmentVariables(os: OS, cudaPath: string): void {
1718
if (os === OS.LINUX) {
@@ -101,7 +102,9 @@ async function run(): Promise<void> {
101102
osType === OS.LINUX ? linuxDistribution! : windowsVersion!
102103
);
103104
} catch (error) {
104-
core.info(`CUDA network installation failed for version ${targetCudaVersion}: ${error}`);
105+
core.info(
106+
`CUDA network installation failed for version ${targetCudaVersion}: ${getErrorMessage(error)}`
107+
);
105108
core.info('Falling back to local installation');
106109
cudaPath = await installCudaLocal(targetCudaVersion, osType, arch);
107110
}
@@ -126,4 +129,4 @@ async function run(): Promise<void> {
126129
}
127130
}
128131

129-
run();
132+
void run();

0 commit comments

Comments
 (0)