fix(ci): #158 upstream the DISABLE_BASE_PATH E2E harness switch#176
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Upstreams the
DISABLE_BASE_PATHE2E 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/*.jsasset 404s under serve-at-root, React never hydrates, and the whole suite fails.The template achieved root-path builds via
GITHUB_ACTIONS: falseon the build step. But the runner re-injectsGITHUB_ACTIONS=trueinto the child processespnpm buildspawns (scripts/detect-project.js/next.configexecSync), so that signal is unreliable — the template only survived becausepublic/CNAMEis 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.js—DISABLE_BASE_PATH === 'true'zeroes basePath first, winning over both auto-detection and an explicitNEXT_PUBLIC_BASE_PATH. (Matches the fork verbatim; the hardenedparseGitUrlwas 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 envGITHUB_ACTIONS: false→DISABLE_BASE_PATH: 'true'with an explanatory comment.Verification
node --test scripts/__tests__/detect-project.test.js→ 23 pass / 0 fail (was 21).generateConfig()under CI-accurate env (GITHUB_ACTIONS=true,DISABLE_BASE_PATH=true,NEXT_PUBLIC_BASE_PATHunset) →basePath: "".NEXT_PUBLIC_BASE_PATH=/ScriptHammerplusDISABLE_BASE_PATH=true→ still""(disable overrides).out/(this is the mechanism the whole E2E suite depends on).Closes #158
🤖 Generated with Claude Code