Skip to content

feat(fullstack init --next): default frontend branch to 'next' on nuxt-base-starter#84

Merged
pascal-klesse merged 2 commits intomainfrom
feat/next-uses-nuxt-base-starter-next-branch
May 3, 2026
Merged

feat(fullstack init --next): default frontend branch to 'next' on nuxt-base-starter#84
pascal-klesse merged 2 commits intomainfrom
feat/next-uses-nuxt-base-starter-next-branch

Conversation

@pascal-klesse
Copy link
Copy Markdown
Member

Summary

  • lt fullstack init --next now clones lenneTech/nuxt-base-starter#next by default for the frontend, so the cloned app's Better-Auth basePath (/api/auth) lines up with the --next (nest-base) backend out of the box.
  • Explicit --frontend-branch <ref> (and lt.config's frontendBranch) still win — so consumers can still target a custom branch on either the legacy or next-derived line.
  • Without --next, behaviour is unchanged: frontendBranch falls back to cliFrontendBranch || configFrontendBranch and is undefined if neither is provided.

Why

During the nest-base LLM-test on 2026-05-03 (friction log entry #5, blocker), a freshly initialised lt fullstack init --next workspace failed the Better-Auth handshake with a 404 because the frontend kept hitting /iam (the main-branch default of nuxt-base-starter) while the experimental --next API only serves /api/auth. The user had to discover --frontend-branch next themselves to unblock the flow.

This wires the default so the two halves of --next agree without extra flags.

Behaviour

# Implicit default — clones nuxt-base-starter#next
lt fullstack init --next --name my-app --frontend nuxt --noConfirm

# Explicit override still works (under --next or otherwise)
lt fullstack init --next --frontend-branch experiments/oauth ...

# Without --next, no default branch — clones the repo's default ref
lt fullstack init --name my-app --frontend nuxt --noConfirm

The CLI usage hint emitted by nonInteractiveHint(...) now mentions the implicit default so scripted callers (Claude Code, CI) discover it without reading source.

Implementation

Single-line change in src/commands/fullstack/init.ts, in the existing frontendBranch derivation:

const frontendBranch =
  cliFrontendBranch || configFrontendBranch || (experimental ? 'next' : undefined);

The value flows unchanged into frontendHelper.setupNuxt({ branch: frontendBranch, ... }) (verified by test 3 below).

Test plan

  • Test 1 — --next (no --frontend-branch): derivation resolves to 'next'. The regex test asserts that the derivation references both cliFrontendBranch and experimental ? 'next', in that order, so the explicit flag still wins.
  • Test 2 — --next --frontend-branch <ref>: the explicit value wins (covered by ordering assertion: cliFrontendBranch is checked before the experimental ternary).
  • Test 3 — No --next: legacy fallback chain preserved (cliFrontendBranch || configFrontendBranch), so frontendBranch is undefined when neither is provided.
  • Forwarding — frontendHelper.setupNuxt still receives branch: frontendBranch unchanged.
  • Usage-hint regression — --next is documented in the nonInteractiveHint so non-interactive callers see the implicit default.
  • Full Jest suite green locally (npm run test): 161 passed, 1 skipped.
  • CLI smoke test green locally (bash scripts/check-cli-start.sh): menu appears.
  • CI green on this PR.

Tests follow the source-introspection pattern already established by __tests__/fullstack-init-next-rename.test.ts — running the full gluegun command in-process would require mocking the entire frontend helper, git, and prompts surface, which adds maintenance cost without buying meaningful coverage for a one-liner derivation. The added tests pin the derivation contract (CLI > config > experimental default > undefined) and the forwarding contract (branch: frontendBranch reaches setupNuxt).

Refs: nest-base LLM-test 2026-05-03 friction #5 (auth path blocker).

Generated with the help of Claude Code.

pascal-klesse and others added 2 commits May 3, 2026 17:23
…t-base-starter

The `next` branch on lenneTech/nuxt-base-starter ships an auth basePath
aligned with nest-base (`/api/auth`) instead of nest-server-starter's
`/iam`. With `--next`, that's now the implicit default; explicit
`--frontend-branch` still wins.

Refs: nest-base LLM-test 2026-05-03 friction #5 (auth path blocker).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… with sibling test file

ts-jest treats every test file as part of one TypeScript program, so
two files with top-level `const fs = require('fs')` collide. The
neighbouring `fullstack-init-next-rename.test.ts` already owns the
unprefixed `fs` / `path` names; this commit moves this file's requires
inside the describe block (matching how that file already scopes
`gluegun` / `filesystem` / `patching`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pascal-klesse pascal-klesse merged commit 36eb7cc into main May 3, 2026
1 check passed
@pascal-klesse pascal-klesse deleted the feat/next-uses-nuxt-base-starter-next-branch branch May 3, 2026 15:37
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.

1 participant