Skip to content
Draft

Yarn4 #15925

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ado/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ extends:
displayName: Remove postinstall
condition: and(succeeded(), eq(variables['detectScenario.isReleaseBuild'], 'False'))
- script: npx --yes midgard-yarn-strict@1.2.4 @rnw-scripts/beachball-config
- script: yarn install --immutable
displayName: Strict yarn install @rnw-scripts/beachball-config
condition: and(succeeded(), eq(variables['detectScenario.isReleaseBuild'], 'False'))

Expand Down
2 changes: 1 addition & 1 deletion .ado/prepare-release-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- script: if not exist %APPDATA%\npm (mkdir %APPDATA%\npm)
displayName: Ensure npm directory for npx commands

- script: npx --yes midgard-yarn@1.23.34 --ignore-scripts --frozen-lockfile
- script: yarn install --immutable
displayName: yarn install

- script: npx lage build --scope @rnw-scripts/prepare-release --scope @rnw-scripts/beachball-config
Expand Down
2 changes: 0 additions & 2 deletions .ado/templates/prepare-js-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ steps:
condition: eq(variables['Agent.OS'], 'Windows_NT')

- template: yarn-install.yml
parameters:
agentImage: ${{ parameters.agentImage }}

- script: yarn build
displayName: yarn build
4 changes: 2 additions & 2 deletions .ado/templates/strict-yarn-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ parameters:
default: react-native-windows-repo

steps:
# midgard-yarn-strict does not respect --ignore-scripts
# Remove postinstall to avoid running build during install
- pwsh: |
$packageJson = Get-Content ./package.json | ConvertFrom-Json
$packageJson.scripts = $packageJson.scripts | Select-Object * -ExcludeProperty postinstall
$packageJson | ConvertTo-Json | Out-File ./package.json
displayName: Remove postinstall

- script: npx --yes midgard-yarn-strict@1.2.4 ${{ parameters.workspace }}
- script: yarn install --immutable
displayName: Strict yarn install ${{ parameters.workspace }}
1 change: 0 additions & 1 deletion .ado/templates/verdaccio-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ steps:
- script: |
call npm config set registry http://localhost:4873
call yarn config set registry http://localhost:4873
call yarn config set npmRegistryServer http://localhost:4873
call yarn config set unsafeHttpWhitelist --json "[\"localhost\"]"
displayName: Modify npm/yarn config to point to local verdaccio server
Expand Down
5 changes: 2 additions & 3 deletions .ado/templates/verdaccio-stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ steps:

- script: |
call npm config delete registry
call yarn config delete registry
call yarn config delete npmRegistryServer
call yarn config delete unsafeHttpWhitelist
call yarn config unset npmRegistryServer
call yarn config unset unsafeHttpWhitelist
displayName: Reset npm/yarn config to stop poiting at local verdaccio server
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
19 changes: 2 additions & 17 deletions .ado/templates/yarn-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,7 @@ parameters:
- name: workingDirectory
type: string
default: .
- name: agentImage
type: string
default: ManagedImage
values:
- ManagedImage
- HostedImage

steps:
# When using our own images, prefer the machine-installed version of
# `midgard-yarn`.
- ${{ if eq(parameters.agentImage, 'ManagedImage') }}:
- script: midgard-yarn --ignore-scripts --frozen-lockfile --cwd ${{ parameters.workingDirectory }}
displayName: midgard-yarn (faster yarn install)

# If using an image we don't control, acquire a fixed version of midgard-yarn
# before install
- ${{ else }}:
- script: npx --yes midgard-yarn@1.23.34 --ignore-scripts --frozen-lockfile --cwd ${{ parameters.workingDirectory }}
displayName: midgard-yarn (faster yarn install)
- script: yarn install --immutable --cwd ${{ parameters.workingDirectory }}
displayName: yarn install (immutable)
4 changes: 0 additions & 4 deletions .ado/variables/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ variables:
# Guardian Config
GDN_DOTNET_INSTALL: false
GDN_SUPPRESS_FORKED_BUILD_WARNING: true

# Yarn Config
YARN_CACHE_FOLDER: $(Agent.TempDirectory)/.yarnCache
YARN_NETWORK_CONCURRENCY: 40
5 changes: 1 addition & 4 deletions .github/workflows/compliance-yarn-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@ jobs:
with:
node-version: '20'

- name: Install Yarn
run: npm install -g yarn

- name: Delete yarn.lock and reinstall dependencies (skip scripts)
working-directory: ./repo
run: |
echo "🧹 Removing yarn.lock..."
rm -f yarn.lock
echo "📦 Running yarn install without lifecycle scripts..."
yarn install --ignore-scripts
yarn install --mode=skip-build

- name: Commit and push changes via gh CLI
working-directory: ./repo
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/perf-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable

- name: Detect preinstalled Windows SDK
id: winsdk
Expand Down
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ build/Release
# Dependency directory
node_modules

# Yarn v4
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
.pnp.*

# Optional npm cache directory
.npm

Expand Down Expand Up @@ -193,8 +201,5 @@ nul
/packages/jest-environment-winappdriver/*
/packages/node-rnw-rpc/*

# midgard-yarn-strict
.store*/*

/npm-pkgs
/.claude/
940 changes: 940 additions & 0 deletions .yarn/releases/yarn-4.13.0.cjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
enableScripts: false
enableScripts: false

yarnPath: .yarn/releases/yarn-4.13.0.cjs

nodeLinker: node-modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Move to yarn4",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "none"
}
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
"@rnw-scripts/promote-release": "*",
"@rnw-scripts/stamp-version": "0.0.0",
"@rnw-scripts/take-screenshot": "*",
"@rnw-scripts/unbroken": "*",
"beachball": "^2.20.0",
"fast-glob": "^3.2.11",
"husky": "^4.2.5",
"prettier-plugin-hermes-parser": "0.21.1",
"react-native-platform-override": "0.0.0-canary.1017",
"@rnw-scripts/unbroken": "*",
"lage": "^2.7.1",
"lodash": "^4.17.15"
"lodash": "^4.17.15",
"prettier-plugin-hermes-parser": "0.21.1",
"react-native-platform-override": "0.0.0-canary.1017"
},
"resolutions": {
"react": "19.2.3",
Expand All @@ -59,13 +59,13 @@
"safe-buffer": "^5.2.1",
"set-value": "^4.0.1",
"strip-ansi": "^6.0.1",
"**/parse-url/normalize-url": "^4.5.1",
"**/@react-native/monorepo/node_modules/jest-junit": "^13.0.0",
"**/@react-native/monorepo/node_modules/ws": "^6.2.3",
"**/@react-native/tester/ws": "^6.2.3",
"**/webdriverio/**/puppeteer-core/ws": "^8.17.1",
"**/detox/ws": "^5.2.4",
"parse-url/normalize-url": "^4.5.1",
"@react-native/monorepo/jest-junit": "^13.0.0",
"@react-native/monorepo/ws": "^6.2.3",
"@react-native/tester/ws": "^6.2.3",
"puppeteer-core/ws": "^8.17.1",
"detox/ws": "^5.2.4",
"xml2js": "^0.5.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "yarn@4.13.0"
}
4 changes: 2 additions & 2 deletions packages/e2e-test-app-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"@babel/preset-typescript": "^7.8.3",
"@babel/runtime": "^7.20.0",
"@react-native-community/cli": "20.0.0",
"@react-native-windows/perf-testing": "0.0.0-canary.1037",
"@react-native/metro-config": "0.84.0-nightly-20260107-58bc6c3e3",
"@react-native-windows/automation": "0.0.0-canary.1045",
"@react-native-windows/automation-commands": "0.0.0-canary.1045",
"@react-native-windows/perf-testing": "0.0.0-canary.1037",
"@react-native/metro-config": "0.84.0-nightly-20260107-58bc6c3e3",
"@rnw-scripts/babel-node-config": "2.3.3",
"@rnw-scripts/babel-react-native-config": "0.0.0",
"@rnw-scripts/eslint-config": "1.2.38",
Expand Down
2 changes: 1 addition & 1 deletion packages/sample-custom-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"dependencies": {
"@types/react": "^19.2.3",
"react": "^19.2.3",
"minimatch": "^10.0.3",
"react": "^19.2.3",
"react-native": "0.84.0-nightly-20260107-58bc6c3e3",
"react-native-windows": "^0.0.0-canary.1045"
},
Expand Down
1 change: 0 additions & 1 deletion vnext/Scripts/creaternwapp.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ call git commit -m "npx --yes @react-native-community/cli@%RNCLI_VERSION% init %

if %USE_VERDACCIO% equ 1 (
@echo creaternwapp.cmd: Setting yarn to use verdaccio at http://localhost:4873
call yarn config set registry http://localhost:4873
call yarn config set npmRegistryServer http://localhost:4873
call yarn config set unsafeHttpWhitelist --json "[\"localhost\"]"
)
Expand Down
1 change: 0 additions & 1 deletion vnext/Scripts/creaternwlib.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ call yarn install

if %USE_VERDACCIO% equ 1 (
@echo creaternwlib.cmd: Setting yarn to use verdaccio at http://localhost:4873
call yarn config set registry http://localhost:4873
call yarn config set npmRegistryServer http://localhost:4873
call yarn config set unsafeHttpWhitelist --json "[\"localhost\"]"
)
Expand Down
Loading
Loading