Skip to content

Commit 8a5b6ef

Browse files
committed
build: converted from yarn v1 to yarn berry (v4.10.3 currently)
- using the "postinstall-dev" plugin to run prepare and patch-package for us
1 parent 7148152 commit 8a5b6ef

File tree

16 files changed

+30089
-21462
lines changed

16 files changed

+30089
-21462
lines changed

.github/workflows/create_test_patches.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,11 @@ jobs:
3333
- uses: actions/setup-node@v6
3434
with:
3535
node-version: 24
36-
- name: Get yarn cache directory path
37-
id: yarn-cache-dir-path
38-
run: echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
3936
- uses: actions/cache/restore@v4
4037
name: Yarn Cache
4138
id: yarn-cache
4239
with:
43-
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
40+
path: .yarn/cache
4441
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
4542
restore-keys: |
4643
${{ runner.os }}-yarn-
@@ -50,7 +47,7 @@ jobs:
5047
timeout_minutes: 10
5148
retry_wait_seconds: 60
5249
max_attempts: 3
53-
command: DETOX_DISABLE_POSTINSTALL=1 yarn --no-audit --prefer-offline
50+
command: DETOX_DISABLE_POSTINSTALL=1 yarn
5451

5552
- name: Create Patches
5653
env:
@@ -62,7 +59,8 @@ jobs:
6259
mkdir $HOME/scratch
6360
echo "Packing PR version of $CLEAN_PACKAGE_NAME"
6461
yarn pack
65-
mv *tgz $HOME/scratch
62+
pwd
63+
mv package.tgz $HOME/scratch/$CLEAN_PACKAGE_NAME.tgz
6664
ls -la $HOME/scratch/*$CLEAN_PACKAGE_NAME*
6765
cd $HOME
6866
npx @react-native-community/cli init template --skip-install --skip-git-init
@@ -73,18 +71,12 @@ jobs:
7371
echo "Installing $CLEAN_PACKAGE_NAME into fresh template app, then clobbering with PR version"
7472
yarn add $PACKAGE_NAME
7573
pushd node_modules/
76-
tar -zxf $HOME/scratch/*$CLEAN_PACKAGE_NAME*-v*
74+
tar -zxf $HOME/scratch/*$CLEAN_PACKAGE_NAME*
7775
mv react-native-google-mobile-ads/package.json package/
7876
\rm -fr react-native-google-mobile-ads
7977
mv package react-native-google-mobile-ads
8078
# do some cleaning so the patch is minimal - TODO fix .npmignore/package.json files block
8179
rm react-native-google-mobile-ads/CHANGELOG.md
82-
rm react-native-google-mobile-ads/android/.npmignore
83-
rm react-native-google-mobile-ads/ios/.npmignore
84-
rm react-native-google-mobile-ads/ios/RNGoogleMobileAds.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
85-
rm react-native-google-mobile-ads/ios/RNGoogleMobileAds.xcodeproj/project.xcworkspace/contents.xcworkspacedata
86-
rm react-native-google-mobile-ads/ios/RNGoogleMobileAds.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
87-
rm react-native-google-mobile-ads/RNGoogleMobileAdsExample/android/gradle/wrapper/gradle-wrapper.jar
8880
popd
8981
npx patch-package $PACKAGE_NAME || true
9082
ls -la $HOME/template/patches
@@ -100,7 +92,7 @@ jobs:
10092
name: Yarn Cache Save
10193
if: "${{ github.ref == 'refs/heads/main' }}"
10294
with:
103-
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
95+
path: .yarn/cache
10496
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
10597

10698
# create a comment on the PR and any related issues with a direct link to the archive,

.github/workflows/docs.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ jobs:
2020
- uses: actions/setup-node@v6
2121
with:
2222
node-version: 24
23-
- name: Get yarn cache directory path
24-
id: yarn-cache-dir-path
25-
run: echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
2623
- uses: actions/cache@v4
2724
name: Yarn Cache
2825
id: yarn-cache
2926
with:
30-
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
27+
path: .yarn/cache
3128
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
3229
restore-keys: |
3330
${{ runner.os }}-yarn-
@@ -37,7 +34,7 @@ jobs:
3734
timeout_minutes: 5
3835
retry_wait_seconds: 60
3936
max_attempts: 3
40-
command: yarn --no-audit --prefer-offline
37+
command: yarn
4138
- name: Spell check
4239
run: |
4340
yarn lint:spellcheck

.github/workflows/linting.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ jobs:
2424
- uses: actions/setup-node@v6
2525
with:
2626
node-version: 24
27-
- name: Get yarn cache directory path
28-
id: yarn-cache-dir-path
29-
run: echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
3027
- uses: actions/cache@v4
3128
name: Yarn Cache
3229
id: yarn-cache
3330
with:
34-
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
31+
path: .yarn/cache
3532
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
3633
restore-keys: |
3734
${{ runner.os }}-yarn-
@@ -41,7 +38,7 @@ jobs:
4138
timeout_minutes: 3
4239
retry_wait_seconds: 30
4340
max_attempts: 3
44-
command: yarn --no-audit --prefer-offline
41+
command: yarn
4542
- name: Lint
4643
run: yarn lint:code
4744
- name: Save Code Linting Report JSON
@@ -70,14 +67,11 @@ jobs:
7067
- uses: actions/setup-node@v6
7168
with:
7269
node-version: 24
73-
- name: Get yarn cache directory path
74-
id: yarn-cache-dir-path
75-
run: echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
7670
- uses: actions/cache@v4
7771
name: Yarn Cache
7872
id: yarn-cache
7973
with:
80-
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
74+
path: .yarn/cache
8175
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
8276
restore-keys: |
8377
${{ runner.os }}-yarn-
@@ -87,7 +81,7 @@ jobs:
8781
timeout_minutes: 3
8882
retry_wait_seconds: 30
8983
max_attempts: 3
90-
command: yarn --no-audit --prefer-offline
84+
command: yarn
9185
- name: Lint
9286
run: yarn tsc:compile
9387

@@ -102,14 +96,11 @@ jobs:
10296
# - uses: actions/setup-node@v4
10397
# with:
10498
# node-version: 18
105-
# - name: Get yarn cache directory path
106-
# id: yarn-cache-dir-path
107-
# run: echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
10899
# - uses: actions/cache@v4
109100
# name: Yarn Cache
110101
# id: yarn-cache
111102
# with:
112-
# path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
103+
# path: .yarn/cache
113104
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}-with-website
114105
# restore-keys: |
115106
# ${{ runner.os }}-yarn-
@@ -119,13 +110,13 @@ jobs:
119110
# timeout_minutes: 3
120111
# retry_wait_seconds: 30
121112
# max_attempts: 3
122-
# command: yarn --no-audit --prefer-offline
113+
# command: yarn
123114
# - name: Yarn Install (Website)
124115
# uses: nick-fields/retry@v3
125116
# with:
126117
# timeout_minutes: 3
127118
# retry_wait_seconds: 30
128119
# max_attempts: 3
129-
# command: cd website && yarn --no-audit --prefer-offline
120+
# command: cd website && yarn
130121
# - name: Generate TypeDoc
131122
# run: node -e "require('./website/scripts/generate-typedoc').generateTypedoc()"

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
timeout_minutes: 10
3434
retry_wait_seconds: 60
3535
max_attempts: 3
36-
command: yarn --no-audit --prefer-offline
36+
command: yarn
3737
- name: Publish Packages
3838
run: yarn semantic-release
3939
env:

.github/workflows/tests_e2e_android.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,13 @@ jobs:
8181
id: workflow-variables
8282
run: |
8383
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT
84-
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
8584
echo "tempdir=$TMPDIR" >> $GITHUB_OUTPUT
8685
8786
- uses: actions/cache@v4
8887
name: Yarn Cache
8988
id: yarn-cache
9089
with:
91-
path: ${{ steps.workflow-variables.outputs.yarn-cache-dir }}
90+
path: .yarn/cache
9291
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
9392
restore-keys: ${{ runner.os }}-yarn-v1
9493

@@ -98,7 +97,7 @@ jobs:
9897
timeout_minutes: 10
9998
retry_wait_seconds: 60
10099
max_attempts: 3
101-
command: yarn --no-audit --prefer-offline && cd RNGoogleMobileAdsExample && DETOX_DISABLE_POSTINSTALL=1 yarn --no-audit --prefer-offline
100+
command: yarn && cd RNGoogleMobileAdsExample && DETOX_DISABLE_POSTINSTALL=1 yarn
102101

103102
- name: Setup Gradle
104103
uses: gradle/actions/setup-gradle@v3

.github/workflows/tests_e2e_ios.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ jobs:
5050
id: workflow-variables
5151
run: |
5252
echo "metro-cache=$HOME/.metro" >> $GITHUB_OUTPUT
53-
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
5453
echo "xcode-version=$(xcodebuild -version|tail -1|cut -f3 -d' ')" >> $GITHUB_OUTPUT
5554
5655
- uses: actions/cache@v4
5756
name: Yarn Cache
5857
id: yarn-cache
5958
with:
60-
path: ${{ steps.workflow-variables.outputs.yarn-cache-dir }}
59+
path: .yarn/cache
6160
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
6261
restore-keys: ${{ runner.os }}-yarn-v1
6362

.github/workflows/tests_jest.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,11 @@ jobs:
3636
- uses: actions/setup-node@v6
3737
with:
3838
node-version: 24
39-
- name: Get yarn cache directory path
40-
id: yarn-cache-dir-path
41-
run: echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
4239
- uses: actions/cache@v4
4340
name: Yarn Cache
4441
id: yarn-cache
4542
with:
46-
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache-dir }}
43+
path: .yarn/cache
4744
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json', 'RNGoogleMobileAdsExample/package.json') }}
4845
restore-keys: |
4946
${{ runner.os }}-yarn-
@@ -53,7 +50,7 @@ jobs:
5350
timeout_minutes: 5
5451
retry_wait_seconds: 60
5552
max_attempts: 3
56-
command: yarn --no-audit --prefer-offline
53+
command: yarn
5754
- name: Jest
5855
run: yarn tests:jest-coverage
5956
- uses: codecov/codecov-action@v5

.gitignore

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,4 +569,18 @@ website/public
569569
# generated files by bob
570570
lib/
571571

572-
.yarn
572+
# Yarn2+ items
573+
.yarn/*
574+
# !.yarn/cache
575+
!.yarn/patches
576+
!.yarn/plugins
577+
!.yarn/releases
578+
!.yarn/sdks
579+
!.yarn/versions
580+
**/.yarn/*
581+
# !**/.yarn/cache
582+
!**/.yarn/patches
583+
!**/.yarn/plugins
584+
!**/.yarn/releases
585+
!**/.yarn/sdks
586+
!**/.yarn/versions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
//prettier-ignore
3+
module.exports = {
4+
name: "@yarnpkg/plugin-postinstall-dev",
5+
factory: function (require) {
6+
var plugin=(()=>{var i=Object.create,s=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var u=t=>s(t,"__esModule",{value:!0});var f=t=>{if(typeof require!="undefined")return require(t);throw new Error('Dynamic require of "'+t+'" is not supported')};var g=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},k=(t,e,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d(e))!p.call(t,r)&&r!=="default"&&s(t,r,{get:()=>e[r],enumerable:!(o=n(e,r))||o.enumerable});return t},P=t=>k(u(s(t!=null?i(l(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var x={};g(x,{default:()=>w});var c=P(f("@yarnpkg/core")),a="postinstallDev",h={hooks:{async afterAllInstalled(t){let e=t.topLevelWorkspace.anchoredLocator;if(await c.scriptUtils.hasPackageScript(e,a,{project:t})){let o=await c.scriptUtils.executePackageScript(e,a,[],{project:t,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr});if(o!==0){let r=new Error(`${a} script failed with exit code ${o}`);throw r.stack=void 0,r}}}}},w=h;return x;})();
7+
return plugin;
8+
}
9+
};

0 commit comments

Comments
 (0)