Skip to content

feat(build): auto-install deps when node_modules is missing#35

Merged
UtkarshBhardwaj007 merged 2 commits intomainfrom
feat/auto-install-on-build
Apr 20, 2026
Merged

feat(build): auto-install deps when node_modules is missing#35
UtkarshBhardwaj007 merged 2 commits intomainfrom
feat/auto-install-on-build

Conversation

@UtkarshBhardwaj007
Copy link
Copy Markdown
Member

Summary

  • dot build (and the build phase of dot deploy) now auto-install dependencies when node_modules/ is absent, eliminating the cryptic ERR_MODULE_NOT_FOUND that previously surfaced when npx <framework> build ran against an uninstalled project and the ephemeral framework binary couldn't resolve the project's own config-file imports (e.g. vite.config.ts importing vite).
  • Package manager is inferred from the lockfile (pnpm/yarn/bun); falls back to npm when none is present — same logic already used for the build itself.
  • Install decision lives purely in detect.ts (new detectInstallConfig()); the I/O layer in runner.ts runs it before the build via a shared runStreamed helper.
  • Skips the install when node_modules/ already exists, when there's no package.json, or when the project declares zero dependencies.

Test plan

  • pnpm test — 195 passing, including 5 new cases for detectInstallConfig covering: already-installed short-circuit, missing package.json, zero-deps short-circuit, npm fallback, and per-lockfile PM selection (pnpm/yarn/bun).
  • Manual: pnpm cli:install, then dot build in a fresh project with no node_modules and no lockfile — expect a > npm install banner, install output, then npx vite build succeeding.
  • Manual: dot build in a project that already has node_modules — expect no install step, straight to the build.
  • Manual: dot deploy against an uninstalled project — expect the install to stream through the deploy TUI as build-log events, then the build phase to continue normally.

`dot build` (and the build phase of `dot deploy`) used to fall through
to `npx <framework> build` against an uninstalled project, which
ephemerally downloaded the framework binary but then failed with a
confusing ERR_MODULE_NOT_FOUND while loading the project's own config
file (e.g. `vite.config.ts` importing `vite`).

`runBuild` now calls `detectInstallConfig()` before the build and spawns
the matching package-manager install (npm/pnpm/yarn/bun, based on the
detected lockfile) when node_modules/ is absent and package.json
declares any dependency.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 20, 2026

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/feat/auto-install-on-build bash

@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 8e9de42 into main Apr 20, 2026
5 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the feat/auto-install-on-build branch April 20, 2026 21:41
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