Skip to content

Commit 4e02480

Browse files
committed
chore: arch converter
1 parent ac9a339 commit 4e02480

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ The `package.json` file contains various scripts for common tasks:
3737

3838
**Architecture Convert**
3939

40-
- `pod:old`: install old architecture pod for example project
41-
- `pod:new`: install new architecture pod for example project
42-
- `gradle:old`: disable new architecture for example project
43-
- `gradle:new`: enable new architecture for example project
40+
- `new`: convert example project to new architecture
41+
- `old`: convert example project to old architecture
42+
- `new:pod`: convert example project to new architecture with pod install
43+
- `old:pod`: convert example project to old architecture with pod install
4444

4545
**Codegen**
4646

example/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"https://repository.map.naver.com/archive/maven",
5353
"https://devrepo.kakao.com/nexus/content/groups/public/"
5454
],
55-
"newArchEnabled": false
55+
"newArchEnabled": true
5656
},
5757
"ios": {
5858
"newArchEnabled": true

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
"gen:clean": "yarn example prebuild:clean",
4141
"studio": "studio $(pwd)/example/android",
4242
"xcode": "open $(pwd)/example/ios/KakaoExample.xcworkspace",
43-
"pod:old": "yarn example pod:old",
44-
"pod:new": "yarn example pod:new",
45-
"gradle:old": "./script/android-arch-convert.sh false",
46-
"gradle:new": "./script/android-arch-convert.sh true",
43+
"old:pod": "script/arch-convert.sh false true",
44+
"new:pod": "script/arch-convert.sh true true",
45+
"old": "script/arch-convert.sh false false",
46+
"new": "script/arch-convert.sh true false",
4747
"codegen:android": "cd example/android && ./gradlew generateCodegenArtifactsFromSchema",
4848
"codegen:ios": "node node_modules/react-native/scripts/generate-codegen-artifacts.js --path example/ --outputPath example/ios",
4949
"codegen": "yarn codegen:android && yarn codegen:ios"

script/android-arch-convert.sh renamed to script/arch-convert.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PROPERTY="newArchEnabled"
55

66
# New value from first command line argument
77
NEW_VALUE="$1"
8+
POD="$2"
89

910
# Validate new value is either "true" or "false"
1011
if [ "${NEW_VALUE}" != "true" ] && [ "${NEW_VALUE}" != "false" ]; then
@@ -19,4 +20,19 @@ FILE="example/android/gradle.properties"
1920
# cp ${FILE} ${FILE}.bak
2021

2122
# Use 'sed' to replace the property value
22-
sed -i'' -e "s/${PROPERTY}=.*/${PROPERTY}=${NEW_VALUE}/" ${FILE}
23+
sed -i '' -e "s/${PROPERTY}=.*/${PROPERTY}=${NEW_VALUE}/" ${FILE}
24+
25+
JSON="example/app.json"
26+
sed -i '' -e "s/\"newArchEnabled\": true/\"newArchEnabled\": ${NEW_VALUE}/g" $JSON
27+
sed -i '' -e "s/\"newArchEnabled\": false/\"newArchEnabled\": ${NEW_VALUE}/g" $JSON
28+
29+
yarn gen:android
30+
yarn gen:ios
31+
32+
if [[ $POD == 'true' ]]; then
33+
if [[ $NEW_VALUE == 'true' ]]; then
34+
yarn pod:new
35+
else
36+
yarn pod:old
37+
fi
38+
fi

0 commit comments

Comments
 (0)