feat(build): auto-install deps when node_modules is missing#35
Merged
UtkarshBhardwaj007 merged 2 commits intomainfrom Apr 20, 2026
Merged
feat(build): auto-install deps when node_modules is missing#35UtkarshBhardwaj007 merged 2 commits intomainfrom
UtkarshBhardwaj007 merged 2 commits intomainfrom
Conversation
`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.
Contributor
|
Dev build ready — try this branch: |
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
dot build(and the build phase ofdot deploy) now auto-install dependencies whennode_modules/is absent, eliminating the crypticERR_MODULE_NOT_FOUNDthat previously surfaced whennpx <framework> buildran against an uninstalled project and the ephemeral framework binary couldn't resolve the project's own config-file imports (e.g.vite.config.tsimportingvite).pnpm/yarn/bun); falls back tonpmwhen none is present — same logic already used for the build itself.detect.ts(newdetectInstallConfig()); the I/O layer inrunner.tsruns it before the build via a sharedrunStreamedhelper.node_modules/already exists, when there's nopackage.json, or when the project declares zero dependencies.Test plan
pnpm test— 195 passing, including 5 new cases fordetectInstallConfigcovering: already-installed short-circuit, missing package.json, zero-deps short-circuit, npm fallback, and per-lockfile PM selection (pnpm/yarn/bun).pnpm cli:install, thendot buildin a fresh project with nonode_modulesand no lockfile — expect a> npm installbanner, install output, thennpx vite buildsucceeding.dot buildin a project that already hasnode_modules— expect no install step, straight to the build.dot deployagainst an uninstalled project — expect the install to stream through the deploy TUI asbuild-logevents, then the build phase to continue normally.