From 0e5da11e273d0480c136f029d2b977827fffd2d4 Mon Sep 17 00:00:00 2001 From: httphypixelnet Date: Fri, 21 Aug 2026 01:01:26 -0700 Subject: [PATCH 1/2] fix ci --- .github/workflows/publish.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4f4dfc..9eb1130 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,21 +11,20 @@ permissions: jobs: auto-publish: runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ github.token }} steps: - name: Checkout repository uses: actions/checkout@v7 - uses: pnpm/setup@v1 with: - runtime: "bun@1.3.14" + runtime: "bun@1.4" install: false - name: Install development dependencies run: pnpm install --frozen-lockfile --ignore-scripts - - name: SymLink bun - run: if ! command -v node >/dev/null 2>&1; then ln -s "$(command -v bun)" /usr/local/bin/node; fi - name: Check for new version and commit it to metafile run: echo "VERSION=$(bun src/bump.ts)" >> $GITHUB_ENV - - name: Publish to npm run: | if [ -z "${{ env.VERSION }}" ]; then @@ -35,6 +34,6 @@ jobs: git config --local user.email "action@github.com" git add meta.json git commit -am "Bump: ${{ env.VERSION }}" - pnpm publish --access public --provenance --no-git-checks --dry + pnpm publish --access public --provenance --no-git-checks fi From 7c85a609bcc6ada30deb9dc2bd1c10447972e8cd Mon Sep 17 00:00:00 2001 From: httphypixelnet Date: Mon, 31 Aug 2026 18:37:34 -0700 Subject: [PATCH 2/2] add VALE_BIN environment override --- README.md | 8 ++++++++ src/vale.ts | 48 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2667902..2a885f7 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,11 @@ npx vale ## Why Because the ones who know, know. + +## Advanced + +If you need to use a different binary than the pre-installed one (ie: the package doesn't support your system), you can specify a custom one like so: + +```bash +VALE_BIN="/path/to/vale" npx vale +``` \ No newline at end of file diff --git a/src/vale.ts b/src/vale.ts index 4ae7ef2..6eb1bab 100644 --- a/src/vale.ts +++ b/src/vale.ts @@ -1,18 +1,42 @@ #!/usr/bin/env node import { spawnSync } from "node:child_process"; -import { outputBin } from "./shared"; import { existsSync } from "fs-extra"; -if (existsSync(outputBin)) { - const result = spawnSync(outputBin, process.argv.slice(2), { - stdio: "inherit", - }); - if (result.signal) { - console.error(`Process failed with signal: ${result.signal}`); +import { outputBin } from "./shared"; + +function resolveBin(): string { + const { VALE_BIN } = process.env; + + if (VALE_BIN) { + if (existsSync(VALE_BIN)) { + return VALE_BIN; + } + console.error( + `VALE_BIN variable was specified but the path could not be found. Tried binary: ${VALE_BIN}`, + ); + process.exit(1) } - if (result.error) { - console.error(`Failed to run Vale, process exited with error: ${result.error.message}`) + + if (!existsSync(outputBin)) { + console.error("Missing Vale binary. Did you run the postinstall?"); + process.exit(1); } - process.exit(result.status ?? 1); + + return outputBin; +} + +const bin = resolveBin(); + +const result = spawnSync(bin, process.argv.slice(2), { + stdio: "inherit", +}); + +if (result.signal) { + console.error(`Process failed with signal: ${result.signal}`); +} +if (result.error) { + console.error( + `Failed to run Vale, process exited with error: ${result.error.message}`, + ); } -console.error("Missing Vale binary. Did you run the postinstall?"); -process.exit(1); + +process.exit(result.status ?? 1); \ No newline at end of file