Skip to content

[build-tools] install the repack package with npm in an isolated sandbox - #4728

Merged
hSATAC merged 1 commit into
mainfrom
ash/eng-28285-easrepack-installs-exporepack-app-with-a-hard-coded-yarn-add
Oct 28, 2026
Merged

hSATAC merged 1 commit into
mainfrom
ash/eng-28285-easrepack-installs-exporepack-app-with-a-hard-coded-yarn-add

Conversation

@hSATAC

@hSATAC hSATAC commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

eas/repack installs @expo/repack-app with a hard-coded yarn add that runs with the build machine's npm/Yarn config and no logger. A ~/.npmrc written by a build hook made the install fail with the error hidden from the build log, and nothing in the step could keep that config out.

How

  • Add installIsolatedNpmPackageAsync to install one npm package with an env of only PATH and a fresh HOME, shared with the agent CLI install.
  • Route the install through the EAS npm cache and fall back to the public registry on cache failures, reusing the project install's detection via utils/npmCacheRegistry.ts.
  • Remove the separate npm view version lookup and report the installed version from the package's package.json.
  • Pipe the installer output to the build log.

Test Plan

Added unit coverage for the isolated install, the cache fallback and the no-retry cases, and kept the agent-run tests pinning the same npm arguments. Also ran lint, format and TypeScript checks, and verified locally that a poisoned ~/.npmrc no longer reaches the install.

@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

ENG-28285

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.75%. Comparing base (ee4f03d) to head (cd4886c).

Files with missing lines Patch % Lines
packages/build-tools/src/utils/npmCacheRegistry.ts 91.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4728      +/-   ##
==========================================
+ Coverage   75.75%   75.75%   +0.01%     
==========================================
  Files        1059     1061       +2     
  Lines       52813    52824      +11     
  Branches    11566    11564       -2     
==========================================
+ Hits        40001    40011      +10     
- Misses      11832    11833       +1     
  Partials      980      980              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

} from '@expo/steps';
import { randomUUID } from 'node:crypto';
import fs from 'node:fs';
import fs from 'fs-extra';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally lean toward to not using fs-extra more. either use

  • fs/promises + JSON.parse
  • @expo/json-file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't notice we're removing fs-extra. Will address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just something we have been trying to achieve in expo/expo. fewer dependencies would reduce the dependency chain attack

@hSATAC
hSATAC force-pushed the ash/eng-28285-easrepack-installs-exporepack-app-with-a-hard-coded-yarn-add branch from 15e6358 to cd4886c Compare October 28, 2026 08:59
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

@hSATAC
hSATAC merged commit 15e2302 into main Oct 28, 2026
10 checks passed
@hSATAC
hSATAC deleted the ash/eng-28285-easrepack-installs-exporepack-app-with-a-hard-coded-yarn-add branch October 28, 2026 09:10
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.

2 participants