Skip to content

fix(ci): #158 upstream the DISABLE_BASE_PATH E2E harness switch#176

Merged
TortoiseWolfe merged 1 commit into
mainfrom
fix/158-disable-base-path-switch
Jul 5, 2026
Merged

fix(ci): #158 upstream the DISABLE_BASE_PATH E2E harness switch#176
TortoiseWolfe merged 1 commit into
mainfrom
fix/158-disable-base-path-switch

Conversation

@TortoiseWolfe

Copy link
Copy Markdown
Owner

What

Upstreams the DISABLE_BASE_PATH E2E harness switch from the RescueDogs fork (issue #158), so the template's E2E build has an explicit, unambiguous basePath-off signal — and every future fork gets it for free.

Why

The E2E workflow serves the static export from the root (serve out -l 3000). The build must therefore NOT bake in the GitHub Pages basePath (/ScriptHammer), or every /ScriptHammer/_next/*.js asset 404s under serve-at-root, React never hydrates, and the whole suite fails.

The template achieved root-path builds via GITHUB_ACTIONS: false on the build step. But the runner re-injects GITHUB_ACTIONS=true into the child processes pnpm build spawns (scripts/detect-project.js / next.config execSync), so that signal is unreliable — the template only survived because public/CNAME is a second guard (!cnameExists). A fork deploying to a project-site (no CNAME) would have no working root-anchored E2E without re-inventing this switch.

Changes

  • scripts/detect-project.jsDISABLE_BASE_PATH === 'true' zeroes basePath first, winning over both auto-detection and an explicit NEXT_PUBLIC_BASE_PATH. (Matches the fork verbatim; the hardened parseGitUrl was already present.)
  • scripts/__tests__/detect-project.test.js — +2 cases: disable-wins (incl. overriding an explicit env var) and unset-path-unchanged (CNAME/explicit-env/non-GHA all still resolve correctly).
  • .github/workflows/e2e.yml — build step env GITHUB_ACTIONS: falseDISABLE_BASE_PATH: 'true' with an explanatory comment.

Verification

  • node --test scripts/__tests__/detect-project.test.js → 23 pass / 0 fail (was 21).
  • Real generateConfig() under CI-accurate env (GITHUB_ACTIONS=true, DISABLE_BASE_PATH=true, NEXT_PUBLIC_BASE_PATH unset) → basePath: "".
  • With an explicit NEXT_PUBLIC_BASE_PATH=/ScriptHammer plus DISABLE_BASE_PATH=true → still "" (disable overrides).
  • CI build still emits a root-anchored out/ (this is the mechanism the whole E2E suite depends on).

Closes #158

🤖 Generated with Claude Code

The E2E workflow serves the static export from the ROOT (`serve out -l 3000`),
so the build must NOT bake in the GitHub Pages basePath (/ScriptHammer) or every
/ScriptHammer/_next/*.js asset would 404 and React would never hydrate. The
template achieved this via `GITHUB_ACTIONS: false` on the build step — but the
runner re-injects GITHUB_ACTIONS=true into the child processes `pnpm build`
spawns (detect-project.js / next.config execSync), so that signal is unreliable.
The template only survived because public/CNAME is a second guard.

Port the fork's explicit `DISABLE_BASE_PATH` opt-out into detect-project.js
(disable wins over both auto-detection AND an explicit NEXT_PUBLIC_BASE_PATH) and
switch the e2e.yml build step to it. Now a fork that removes the CNAME gets a
working root-anchored E2E for free instead of re-inventing the switch.

- scripts/detect-project.js: `DISABLE_BASE_PATH === 'true'` zeroes basePath first
- scripts/__tests__/detect-project.test.js: +2 cases (disable wins; unset path
  unchanged), verified via the real generateConfig() — B/C return '' as expected
- .github/workflows/e2e.yml: GITHUB_ACTIONS: false -> DISABLE_BASE_PATH: 'true'

Closes #158

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@TortoiseWolfe TortoiseWolfe merged commit c34b92c into main Jul 5, 2026
17 checks passed
@TortoiseWolfe TortoiseWolfe deleted the fix/158-disable-base-path-switch branch July 5, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upstream the DISABLE_BASE_PATH E2E harness switch from RescueDogs

2 participants