feat(fullstack init --next): flatten nuxt-base-template into projects/app/ post-clone#86
Merged
pascal-klesse merged 2 commits intomainfrom May 3, 2026
Merged
Conversation
…/app/ post-clone `lenneTech/nuxt-base-starter` ships a wrapper repo: the root `package.json` is the `create-nuxt-base` scaffolder (a separate npm package), and the actual Nuxt app lives one level deeper under `nuxt-base-template/`. After `lt fullstack init --next`, the generated monorepo's `pnpm-workspace.yaml` and the README's `cd projects/app && pnpm install && pnpm dev` pointed at the wrapper, so install resolved the wrong dependencies and `pnpm dev` had nothing to run (LLM-test 2026-05-03 friction #3 entry 20:30). After cloning, `setupNuxt` now flattens the layout: the contents of `nuxt-base-template/` (including dotfiles) replace the cloned root, and the wrapper-only files (`index.js`, `pnpm-lock.yaml`, the scaffolder `package.json`, etc.) disappear. The flatten only runs on clone — link mode points at the user's local checkout and must not have its template subdir torn out. Defense-in-depth: stage the template into a sibling tmp dir before wiping `dest`. If extraction fails (corrupt clone, future repo reshape that drops the wrapper), the original layout stays untouched. Both `main` and `next` branches of `nuxt-base-starter` ship the wrapper today, so this fix also benefits the legacy default-branch path, not just `--next`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e-declare `filesystem`
ts-jest treats every test file as part of one TypeScript program, so
my new file's top-level `const { filesystem } = require('gluegun')`
collided with the same declaration in
`fullstack-claude-md-patching.test.ts` (TS2451). The other
`fullstack-init-next-*.test.ts` files already document this gotcha
and require lazily inside the describe block — follow the same
pattern. Local Jest happened to pass (different ts-jest config
between local and CI), but CI failed.
Co-Authored-By: Claude Opus 4.7 (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.
Summary
lt fullstack init --nextcloneslenneTech/nuxt-base-starter(or#next) intoprojects/app/, but the cloned repo is a wrapper —the root
package.jsonis the npm scaffoldercreate-nuxt-base,and the actual Nuxt app lives at
projects/app/nuxt-base-template/.The generated monorepo's
pnpm-workspace.yamland the README'scd projects/app && pnpm install && pnpm devtherefore point at thewrapper, not the app, so install resolves the wrong dependencies and
pnpm devhas nothing to run.This PR makes
setupNuxtflatten the wrapper layout after asuccessful clone: the contents of
nuxt-base-template/(includingdotfiles like
.env.example,.gitignore,.npmrc) replace thecloned root, and the wrapper-only files (
index.js,pnpm-lock.yaml,the scaffolder
package.json, etc.) disappear. After the flatten,projects/app/IS the Nuxt app — exactly what the README andworkspace already assume.
Friction log
Before / After
Backward compatibility
mainandnextofnuxt-base-startership the wrapper today, so the flatten benefitsthe legacy default-branch path too — not just
--next. If a futurebranch drops the wrapper and ships the app at the root, the flatten
becomes a no-op (no
nuxt-base-template/subdir = nothing to do).--frontend-linkis a symlink to theuser's local checkout; flattening would tear out the source tree.
The flatten only runs when
templateHelper.setupreturnsmethod === 'clone'.dir before
destis wiped. If staging fails (corrupt clone, futurerepo reshape, or
nuxt-base-templateexists as a stray file ratherthan a directory), the original layout stays untouched and the
flatten returns
{ flattened: false, reason }. The pre-flattenlayout is annoying but functional — better than wiping a user's
clone over an unexpected layout.
Test plan
__tests__/fullstack-init-next-flatten.test.tscovers the happy path (flatten happens, dotfiles survive,
wrapper-only files are removed), the no-op path (already-flat
layouts), the defensive abort (stray file at the subdir name),
and a source-introspection guard so a future refactor can't
silently drop the call site.
npm test— 165 passed, 1 skipped).npm run lint).lt fullstack init --next --name lt-flatten-test --noConfirmagainst the rebuilt CLI confirmedprojects/app/package.jsonhasname: nuxt-base-template,projects/app/nuxt-base-template/is gone, dotfiles(
.env.example,.gitignore,.npmrc,.nuxtrc) survived,and
nuxt.config.ts+app/are at the project root.🤖 Generated with Claude Code