Skip to content

fix(build): distinguish wrong cwd from missing build strategy#382

Merged
UtkarshBhardwaj007 merged 1 commit into
mainfrom
fix/wrong-cwd-build-error
Jun 13, 2026
Merged

fix(build): distinguish wrong cwd from missing build strategy#382
UtkarshBhardwaj007 merged 1 commit into
mainfrom
fix/wrong-cwd-build-error

Conversation

@UtkarshBhardwaj007

Copy link
Copy Markdown
Member

What

dot build / dot deploy threw the same error — No build strategy detected. Add a "build" script to package.json, or install vite/next/typescript. — in two unrelated situations:

  1. The cwd has no package.json at all (user is one directory above their project, e.g. ran dot mod then dot build from the parent).
  2. The cwd has a package.json but no recognised build strategy.

Case 1 is the common real-world failure (it generated false "app is missing a build script" bug reports), and the message pointed at the wrong fix — editing a package.json that isn't there.

Change

detectBuildConfig now splits the two cases:

  • No package.json: No package.json found in <dir>. Are you in your project directory? cd into it first, or point the command at it with --dir <path>.
  • package.json present but unrecognised: unchanged.

To name the directory while keeping src/utils/build/detect.ts pure (no I/O), an optional projectDir is threaded through DetectInput and populated by loadDetectInput — so both dot build and dot deploy get the named-directory message for free. The message references the existing --dir <path> flag (the positional-arg suggestion from the issue, #3, is intentionally out of scope here).

Scope

This addresses suggestion #1 of #191. Suggestions #2 (dot mod next-step footer) and the audit's --quest hint are already shipped on main; #3 (positional arg) is deliberately not included.

Tests

  • New: wrong-directory error on missing package.json, directory name interpolated into the message, clean fallback when no projectDir is known (no leaked undefined / double space), and a regression lock that the present-but-unrecognised case keeps the original message.
  • pnpm format:check, pnpm lint:license, pnpm typecheck, pnpm test (945 passing) all green.

Refs #191

detectBuildConfig threw the same 'No build strategy detected' message
whether the cwd had no package.json at all or had one with no recognised
build. The first case (user one dir above their project, e.g. after
`dot mod`) is the common failure and the message sent them to the wrong
fix. Split it: when package.json is absent, name the directory and point
the user at it (cd in, or --dir <path>); keep the original message for a
present-but-unrecognised package.json.

Thread an optional projectDir through DetectInput (populated by
loadDetectInput) so the error can name the directory while detect.ts
stays pure.
@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 904abae into main Jun 13, 2026
18 of 20 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the fix/wrong-cwd-build-error branch June 13, 2026 14:37
@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Pass · ❌ FAIL

Tag: e2e-ci-pr · Branch: fix/wrong-cwd-build-error · Commit: cd4d4b7 · Run logs

Cell Result Time
pr-install ✅ PASS 2m02s
pr-deploy-cdm ✅ PASS 4m14s
pr-deploy-foundry ✅ PASS 0m42s
pr-login-session ✅ PASS 1m52s
pr-deploy-frontend ✅ PASS 8m47s
pr-mod ✅ PASS 1m33s
pr-preflight ❌ FAIL 6m33s
${{ matrix.cell }} ⏭️ SKIP 0m-1s
${{ matrix.cell }} ⏭️ SKIP 0m-1s

Sentry traces: view spans for this run

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