Skip to content

fix(cli): never delete the project in nf build and make watch rebuilds safe - #367

Merged
Exeloo merged 7 commits into
mainfrom
fix/build-output
Nov 23, 2026
Merged

Exeloo merged 7 commits into
mainfrom
fix/build-output

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 23, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Closes #275
Closes #278
Closes #279

  • resolveTargets runs assertSafeOutput on each target before anything is deleted. It refuses an output that is:
    • the project folder, one of its parents, outside the project, or absolute;
    • overlapping the entry file, the assets or the dir.components/systems/scenes/packages folders.
    • Paths are compared as real paths: symlinks are followed and case is taken from the disk.
  • p2p: a client rebuild keeps <client out>/server.
  • watch: chokidar all events on the entry folder and the assets folder (output ignored) go to createRebuildQueue: 100 ms debounce, one build at a time, at most one pending. Watching starts after the first build (nf build --watch misses edits saved during the first build #357).
  • @nanoforge-dev/config: out.dir must be relative and strictly inside the project.

How do you test this PR?

Merge danger

Door: two-way.
Blast radius: medium. @nanoforge-dev/config is used at runtime by cli and editor-server-core. The new out.dir rule rejects none of the 50 configs in examples, engine and editor.

Quality gate

Check Result Notes
Docs Updated commands/build.mdx, configuration/configuration-file.mdx. The JSON schemas are stale, filed as #339
Correctness Pass (2 rounds) Minor: src/components accepted, fixed in 1ac7ffa. Minor: dir key undefined, fixed in 5de4437 (not re-reviewed, test failed before)
Performance Pass Minor: one watcher per asset file
Accessibility Pass
Security Pass (2 rounds) Minor ×2 (case, symlink) fixed in 1ac7ffa
Style Pass lint: pass

Follow-up issues

@github-actions github-actions Bot added documentation Improvements or additions to documentation command:build Related to build command lib:config Related to the @nanoforge-dev/config library labels Nov 23, 2026
@Exeloo
Exeloo merged commit 9dc77d9 into main Nov 23, 2026
9 checks passed
@Exeloo
Exeloo deleted the fix/build-output branch November 23, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:build Related to build command documentation Improvements or additions to documentation lib:config Related to the @nanoforge-dev/config library

Projects

None yet

1 participant