Skip to content

Commit 53b468d

Browse files
authored
Migrate to Yarn 4 (#3457)
## Description This PR changes package manager to _**Yarn 4**_ (**_modern_**) I think `workspaces` can be set up along with monorepo setup ## Test plan Build and run example apps
1 parent b9c7af0 commit 53b468d

23 files changed

+52829
-333071
lines changed

.github/workflows/ios-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
cache: 'yarn'
3636
- name: Install node dependencies
3737
working-directory: ${{ matrix.working-directory }}
38-
run: yarn
38+
run: yarn install --immutable
3939
- name: Install pods
4040
working-directory: ${{ matrix.working-directory }}/ios
4141
run: bundle install && NO_FLIPPER=1 bundle exec pod install

.github/workflows/kotlin-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
3737

3838
- name: Install node dependencies
39-
run: yarn install --frozen-lockfile
39+
run: yarn install --immutable
4040

4141
- name: Restore build from cache
4242
uses: actions/cache@v4

.github/workflows/static-example-apps-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
node-version: 18
2828
cache: 'yarn'
2929
- name: Install root node dependencies
30-
run: yarn
30+
run: yarn --immutable && yarn prepare
3131
- name: Install ${{ matrix.working-directory }} app node dependencies
3232
working-directory: ${{ matrix.working-directory }}
3333
run: yarn

.github/workflows/yarn-validation.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Yarn validation
2+
env:
3+
YARN_ENABLE_HARDENED_MODE: 1
4+
on:
5+
pull_request:
6+
paths:
7+
- '.github/workflows/yarn-validation.yml'
8+
- '**/package.json'
9+
- '**/yarn.lock'
10+
merge_group:
11+
branches:
12+
- main
13+
push:
14+
branches:
15+
- main
16+
paths:
17+
- '.github/workflows/yarn-validation.yml'
18+
- '**/package.json'
19+
- '**/yarn.lock'
20+
workflow_call:
21+
workflow_dispatch:
22+
23+
jobs:
24+
check:
25+
if: github.repository == 'software-mansion/react-native-gesture-handler'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Use Node.js
31+
uses: actions/setup-node@v4
32+
33+
- name: Install root dependencies
34+
run: yarn install
35+
36+
- name: Get changed files
37+
id: changed-files
38+
uses: tj-actions/changed-files@v46
39+
with:
40+
files: |
41+
**/package.json
42+
**/yarn.lock
43+
- name: Get list of changed directories
44+
id: changed-dirs
45+
run: |
46+
ECHOLIST=()
47+
for CHANGE in ${{ steps.changed-files.outputs.all_changed_files }}
48+
do
49+
DIR=$(dirname "$CHANGE")
50+
ECHOLIST+=("$DIR")
51+
done
52+
ECHOLIST=($(echo "${ECHOLIST[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
53+
echo "dirList=${ECHOLIST[*]}" >> $GITHUB_OUTPUT
54+
- name: Perform yarn install in changed directories
55+
working-directory: ${{ github.workspace }}
56+
run: |
57+
for DIR in ${{ steps.changed-dirs.outputs.dirList }}
58+
do
59+
echo "Yarn install in $DIR"
60+
echo $(pwd)
61+
cd "$DIR" && yarn install --immutable && cd ${{ github.workspace }}
62+
done

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ jsconfig.json
5858

5959
# Yarn
6060
.yarn/*
61+
!.yarn/cache
62+
!.yarn/patches
63+
!.yarn/plugins
6164
!.yarn/releases
65+
!.yarn/sdks
66+
!.yarn/versions
67+
6268

6369
# TS
6470
dist/

0 commit comments

Comments
 (0)