[eas-cli] Add deno package manager support for builds#3951
Open
yyq1025 wants to merge 1 commit into
Open
Conversation
Detect deno as the package manager when a project (or its workspace root) has a deno.lock lockfile and no Node package manager lockfile. During builds, install dependencies with `deno install` (`--frozen` when a frozen lockfile is requested), run the Expo CLI through `deno run -A npm:expo`, and execute EAS build lifecycle hooks with `deno task`, deno's equivalent of `<packageManager> run`. deno.lock is also accepted by the lockfile presence check, and 'deno' is a valid requiredPackageManager metadata value and EAS_FALLBACK_PACKAGE_MANAGER value. Detection lives in build-tools for now because @expo/package-manager has no deno support; a Node lockfile always wins over deno.lock, so existing projects are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fd7f6a3 to
5e4f143
Compare
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
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.
Why
Deno 2 works well as a package manager for Expo/React Native projects:
deno installmaterializes a Node-compatiblenode_modulestree that Metro,expo export, autolinking, andpod installall resolve correctly (verified end-to-end on an Expo SDK 56 / RN 0.85 app with native modules). But EAS Build only detects npm / yarn / pnpm / bun lockfiles, so a deno-managed project (which has onlydeno.lock) silently falls back to ayarn installwith no lockfile — an unpinned dependency tree, the exact drift a lockfile is meant to prevent.This mirrors how bun support was added (see #2782 for the bun.lock precedent). The immediate audience is
eas build --local, where deno is already on the user's machine.Running the Expo CLI itself under the deno runtime is also a supported path upstream: the Deno team tracked Expo compatibility in denoland/deno#22970 and closed it after fixing the blockers.
How
Following the existing bun pattern across the build pipeline, with three deno-specific semantic mappings:
build-tools/utils/packageManager.ts): a project (or its workspace root) withdeno.lockresolves toPackageManager.DENO.@expo/package-managerhas no deno support yet, so the check lives here for now — and it only runs when the external resolver finds no Node package manager lockfile, so any existing npm/yarn/pnpm/bun project is completely unaffected. Happy to follow up with a PR to@expo/package-managerto move detection to its proper layer.common/installDependencies.ts):deno install, with--frozenwhen a frozen lockfile is requested (deno's equivalent of--frozen-lockfile).deno installhas no--verboseflag, soEAS_VERBOSEis not forwarded.utils/project.ts,steps/functions/prebuild.ts):deno run -A npm:expo <args>— deno has no baredeno expobin runner;npm:exporesolves the copy from localnode_moduleswhen present.utils/hooks.ts):deno task <hook>—deno taskis deno's equivalent of<packageManager> runfor package.json scripts (deno runexecutes files, not scripts).deno.lockis accepted byensureLockfileExistsAsync, and'deno'is a validrequiredPackageManagermetadata value andEAS_FALLBACK_PACKAGE_MANAGERvalue.Scope note: cloud workers don't have deno installed yet, so this primarily targets
eas build --local. On cloud, a deno-only project changes from "silent unpinned yarn install" to an explicit spawn failure — arguably more honest, but I'm happy to gate detection to local builds or add worker provisioning (mirroringinstallBun()) if you'd prefer either.One known follow-up for full parity: deno blocks npm lifecycle scripts by default (
--allow-scripts); projects relying on postinstall-heavy native deps need a story for that. Left out of this PR to keep it reviewable — flagging for discussion.Test Plan
New unit tests mirroring the bun coverage, all passing (
yarn testinbuild-tools,eas-cli,eas-build-job; fulllerna run buildpasses):deno.lockonly → deno;deno.lock+yarn.lock→ yarn (Node lockfile precedence); monorepo withdeno.lockat workspace root → deno;EAS_FALLBACK_PACKAGE_MANAGER=denodeno install/deno install --frozen;EAS_VERBOSEnot forwarded to denodeno run -A npm:expo doctordeno task eas-build-post-installdeno.lockManual verification of the underlying assumption (deno-installed trees build correctly): on a deno-managed Expo SDK 56 / RN 0.85 monorepo app,
deno install+expo export --platform ios(Hermes + DOM component bundles),expo-modules-autolinking resolve(38/38 module parity with the pnpm tree),expo prebuild, andpod installall succeed.🤖 Generated with Claude Code