@nrwl/react-native 12.10.0-beta.2 → 12.10.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +29 -0
- package/package.json +7 -7
- package/plugins/jest/svg-mock.d.ts +0 -0
- package/plugins/jest/svg-mock.js +5 -0
- package/plugins/jest/svg-mock.js.map +1 -0
- package/src/generators/application/files/app/android/app/build.gradle.template +24 -13
- package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +2 -2
- package/src/generators/application/files/app/android/build.gradle.template +4 -3
- package/src/generators/application/files/app/android/gradle.properties +1 -1
- package/src/generators/application/files/app/ios/Podfile.template +1 -0
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +70 -27
- package/src/generators/application/files/app/metro.config.js.template +29 -18
- package/src/generators/application/files/app/package.json.template +4 -3
- package/src/generators/application/files/app/src/app/App.spec.tsx.template +2 -3
- package/src/generators/application/files/app/src/app/App.tsx.template +34 -0
- package/src/generators/application/files/app/src/app/star.svg +11 -0
- package/src/generators/application/files/app/tsconfig.json.template +3 -1
- package/src/generators/init/init.js +2 -1
- package/src/generators/init/init.js.map +1 -1
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.d.ts +8 -0
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js +63 -0
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js.map +1 -0
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.spec.ts +79 -0
- package/src/utils/add-jest.js +4 -0
- package/src/utils/add-jest.js.map +1 -1
- package/src/utils/versions.d.ts +4 -3
- package/src/utils/versions.js +6 -5
- package/src/utils/versions.js.map +1 -1
package/migrations.json
CHANGED
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
"cli": "nx",
|
|
6
6
|
"description": "Update jest for react native",
|
|
7
7
|
"factory": "./src/migrations/update-12-5-0/update-jest-for-react-native"
|
|
8
|
+
},
|
|
9
|
+
"add-react-native-svg-12-10-0": {
|
|
10
|
+
"version": "12.10.0-beta.1",
|
|
11
|
+
"cli": "nx",
|
|
12
|
+
"description": "Add support to display svg in react native",
|
|
13
|
+
"factory": "./src/migrations/update-12-10-0/add-react-native-svg-12-10-0"
|
|
8
14
|
}
|
|
9
15
|
},
|
|
10
16
|
"packageJsonUpdates": {
|
|
@@ -204,6 +210,29 @@
|
|
|
204
210
|
"alwaysAddToPackageJson": false
|
|
205
211
|
}
|
|
206
212
|
}
|
|
213
|
+
},
|
|
214
|
+
"12.10.0-beta.1": {
|
|
215
|
+
"version": "12.10.0-beta.1",
|
|
216
|
+
"packages": {
|
|
217
|
+
"react-native-svg-transformer": {
|
|
218
|
+
"version": "0.14.3",
|
|
219
|
+
"alwaysAddToPackageJson": false,
|
|
220
|
+
"addToPackageJson": "devDependencies"
|
|
221
|
+
},
|
|
222
|
+
"react-native-svg": {
|
|
223
|
+
"version": "12.1.1",
|
|
224
|
+
"alwaysAddToPackageJson": false,
|
|
225
|
+
"addToPackageJson": "devDependencies"
|
|
226
|
+
},
|
|
227
|
+
"react-native": {
|
|
228
|
+
"version": "0.66.0",
|
|
229
|
+
"alwaysAddToPackageJson": false
|
|
230
|
+
},
|
|
231
|
+
"@types/react-native": {
|
|
232
|
+
"version": "0.65.3",
|
|
233
|
+
"alwaysAddToPackageJson": false
|
|
234
|
+
}
|
|
235
|
+
}
|
|
207
236
|
}
|
|
208
237
|
}
|
|
209
238
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react-native",
|
|
3
|
-
"version": "12.10.0-beta.
|
|
3
|
+
"version": "12.10.0-beta.6",
|
|
4
4
|
"description": "React Native Plugin for Nx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Monorepo",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"main": "index.js",
|
|
25
25
|
"types": "index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nrwl/detox": "12.10.0-beta.
|
|
28
|
-
"@nrwl/devkit": "12.10.0-beta.
|
|
29
|
-
"@nrwl/jest": "12.10.0-beta.
|
|
30
|
-
"@nrwl/linter": "12.10.0-beta.
|
|
31
|
-
"@nrwl/react": "12.10.0-beta.
|
|
27
|
+
"@nrwl/detox": "12.10.0-beta.6",
|
|
28
|
+
"@nrwl/devkit": "12.10.0-beta.6",
|
|
29
|
+
"@nrwl/jest": "12.10.0-beta.6",
|
|
30
|
+
"@nrwl/linter": "12.10.0-beta.6",
|
|
31
|
+
"@nrwl/react": "12.10.0-beta.6",
|
|
32
32
|
"chalk": "^4.1.0",
|
|
33
33
|
"ignore": "^5.0.4",
|
|
34
34
|
"metro-resolver": "^0.66.2",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tsconfig-paths": "^3.9.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@nrwl/workspace": "12.10.0-beta.
|
|
39
|
+
"@nrwl/workspace": "12.10.0-beta.6",
|
|
40
40
|
"react-native": "0.65.1"
|
|
41
41
|
},
|
|
42
42
|
"builders": "./executors.json",
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-mock.js","sourceRoot":"","sources":["../../../../../packages/react-native/plugins/jest/svg-mock.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,uBAAuB;AACvB,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC"}
|
|
@@ -20,7 +20,7 @@ import com.android.build.OutputFile
|
|
|
20
20
|
* // default. Can be overridden with ENTRY_FILE environment variable.
|
|
21
21
|
* entryFile: "index.android.js",
|
|
22
22
|
*
|
|
23
|
-
* // https://
|
|
23
|
+
* // https://reactnative.dev/docs/performance#enable-the-ram-format
|
|
24
24
|
* bundleCommand: "ram-bundle",
|
|
25
25
|
*
|
|
26
26
|
* // whether to bundle JS and assets in debug mode
|
|
@@ -121,7 +121,14 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
|
|
121
121
|
*/
|
|
122
122
|
def enableHermes = project.ext.react.get("enableHermes", false);
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Architectures to build native code for in debug.
|
|
126
|
+
*/
|
|
127
|
+
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
|
|
128
|
+
|
|
124
129
|
android {
|
|
130
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
131
|
+
|
|
125
132
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
126
133
|
|
|
127
134
|
defaultConfig {
|
|
@@ -164,10 +171,15 @@ android {
|
|
|
164
171
|
buildTypes {
|
|
165
172
|
debug {
|
|
166
173
|
signingConfig signingConfigs.debug
|
|
174
|
+
if (nativeArchitectures) {
|
|
175
|
+
ndk {
|
|
176
|
+
abiFilters nativeArchitectures.split(',')
|
|
177
|
+
}
|
|
178
|
+
}
|
|
167
179
|
}
|
|
168
180
|
release {
|
|
169
181
|
// Caution! In production, you need to generate your own keystore file.
|
|
170
|
-
//
|
|
182
|
+
// see https://reactnative.dev/docs/signed-apk-android.
|
|
171
183
|
signingConfig signingConfigs.debug
|
|
172
184
|
// signingConfig signingConfigs.release
|
|
173
185
|
minifyEnabled enableProguardInReleaseBuilds
|
|
@@ -175,23 +187,17 @@ android {
|
|
|
175
187
|
}
|
|
176
188
|
}
|
|
177
189
|
|
|
178
|
-
packagingOptions {
|
|
179
|
-
pickFirst "lib/armeabi-v7a/libc++_shared.so"
|
|
180
|
-
pickFirst "lib/arm64-v8a/libc++_shared.so"
|
|
181
|
-
pickFirst "lib/x86/libc++_shared.so"
|
|
182
|
-
pickFirst "lib/x86_64/libc++_shared.so"
|
|
183
|
-
}
|
|
184
|
-
|
|
185
190
|
// applicationVariants are e.g. debug, release
|
|
186
191
|
applicationVariants.all { variant ->
|
|
187
192
|
variant.outputs.each { output ->
|
|
188
193
|
// For each separate APK per architecture, set a unique version code as described here:
|
|
189
194
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
|
195
|
+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
|
190
196
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
|
191
197
|
def abi = output.getFilter(OutputFile.ABI)
|
|
192
198
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
193
199
|
output.versionCodeOverride =
|
|
194
|
-
|
|
200
|
+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
|
|
195
201
|
}
|
|
196
202
|
|
|
197
203
|
}
|
|
@@ -202,13 +208,18 @@ dependencies {
|
|
|
202
208
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
203
209
|
//noinspection GradleDynamicVersion
|
|
204
210
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
211
|
+
|
|
205
212
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
|
213
|
+
|
|
206
214
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
|
|
207
|
-
|
|
215
|
+
exclude group:'com.facebook.fbjni'
|
|
208
216
|
}
|
|
217
|
+
|
|
209
218
|
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
210
219
|
exclude group:'com.facebook.flipper'
|
|
220
|
+
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
211
221
|
}
|
|
222
|
+
|
|
212
223
|
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
|
|
213
224
|
exclude group:'com.facebook.flipper'
|
|
214
225
|
}
|
|
@@ -229,8 +240,8 @@ dependencies {
|
|
|
229
240
|
// Run this once to be able to run the application with BUCK
|
|
230
241
|
// puts all compile dependencies into folder libs for BUCK to use
|
|
231
242
|
task copyDownloadableDepsToLibs(type: Copy) {
|
|
232
|
-
from configurations.
|
|
243
|
+
from configurations.implementation
|
|
233
244
|
into 'libs'
|
|
234
245
|
}
|
|
235
246
|
|
|
236
|
-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
247
|
+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<!-- Base application theme. -->
|
|
3
3
|
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
|
4
4
|
<!-- Customize your theme here. -->
|
|
5
|
-
<item name="android:textColor">#000000</item>
|
|
6
5
|
</style>
|
|
6
|
+
|
|
7
7
|
<style name="Theme.App.SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
|
|
8
8
|
<!-- Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually -->
|
|
9
9
|
<item name="android:windowBackground">@drawable/splashscreen</item>
|
|
10
10
|
<!-- Customize your splash screen theme here -->
|
|
11
11
|
</style>
|
|
12
|
-
</resources>
|
|
12
|
+
</resources>
|
|
@@ -6,14 +6,14 @@ buildscript {
|
|
|
6
6
|
minSdkVersion = 21
|
|
7
7
|
compileSdkVersion = 30
|
|
8
8
|
targetSdkVersion = 30
|
|
9
|
-
ndkVersion = "
|
|
9
|
+
ndkVersion = "21.4.7075529"
|
|
10
10
|
}
|
|
11
11
|
repositories {
|
|
12
12
|
google()
|
|
13
13
|
mavenCentral()
|
|
14
14
|
}
|
|
15
15
|
dependencies {
|
|
16
|
-
classpath("com.android.tools.build:gradle:4.2.
|
|
16
|
+
classpath("com.android.tools.build:gradle:4.2.2")
|
|
17
17
|
// NOTE: Do not place your application dependencies here; they belong
|
|
18
18
|
// in the individual module build.gradle files
|
|
19
19
|
}
|
|
@@ -33,6 +33,7 @@ allprojects {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
google()
|
|
36
|
+
maven { url 'https://www.jitpack.io' }
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
<% if (e2eTestRunner === 'detox') { %>
|
|
@@ -43,4 +44,4 @@ allprojects {
|
|
|
43
44
|
<% } %>
|
|
44
45
|
|
|
45
46
|
}
|
|
46
|
-
}
|
|
47
|
+
}
|
|
@@ -25,7 +25,7 @@ android.useAndroidX=true
|
|
|
25
25
|
android.enableJetifier=true
|
|
26
26
|
|
|
27
27
|
# Version of flipper SDK to use with React Native
|
|
28
|
-
FLIPPER_VERSION=0.
|
|
28
|
+
FLIPPER_VERSION=0.99.0
|
|
29
29
|
|
|
30
30
|
# Production release must be signed
|
|
31
31
|
# See: https://reactnative.dev/docs/signed-apk-android
|
package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
+
00E356F31AD99517003FC87E /* <%= className %>Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* <%= className %>Tests.m */; };
|
|
10
11
|
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
|
|
11
12
|
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
|
|
12
13
|
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
|
13
14
|
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
|
|
14
|
-
|
|
15
|
+
9C141382382E3C900FF41CFE /* libPods-<%= className %>-<%= className %>Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1743840A4091A253DF94ADF3 /* libPods-<%= className %>-<%= className %>Tests.a */; };
|
|
16
|
+
CB28F6E71BFFBBFFE4D6CA71 /* libPods-<%= className %>.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 65E4FAB80E3D35EA640E54A7 /* libPods-<%= className %>.a */; };
|
|
15
17
|
/* End PBXBuildFile section */
|
|
16
18
|
|
|
17
19
|
/* Begin PBXContainerItemProxy section */
|
|
@@ -32,10 +34,10 @@
|
|
|
32
34
|
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = <%= className %>/Images.xcassets; sourceTree = "<group>"; };
|
|
33
35
|
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = <%= className %>/Info.plist; sourceTree = "<group>"; };
|
|
34
36
|
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = <%= className %>/main.m; sourceTree = "<group>"; };
|
|
37
|
+
56DF1300CF795902963DA15C /* Pods-<%= className %>.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-<%= className %>.release.xcconfig"; path = "Target Support Files/Pods-<%= className %>/Pods-<%= className %>.release.xcconfig"; sourceTree = "<group>"; };
|
|
38
|
+
65E4FAB80E3D35EA640E54A7 /* libPods-<%= className %>.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-<%= className %>.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
35
39
|
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = <%= className %>/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
|
36
|
-
|
|
37
|
-
95971177ADC3B43EA1915EFA /* Pods-<%= className %>.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-<%= className %>.release.xcconfig"; path = "Target Support Files/Pods-<%= className %>/Pods-<%= className %>.release.xcconfig"; sourceTree = "<group>"; };
|
|
38
|
-
AE0E2B88164A638A5DDEB356 /* Pods-<%= className %>.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-<%= className %>.debug.xcconfig"; path = "Target Support Files/Pods-<%= className %>/Pods-<%= className %>.debug.xcconfig"; sourceTree = "<group>"; };
|
|
40
|
+
D06EE1839428A1A3F684470B /* Pods-<%= className %>.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-<%= className %>.debug.xcconfig"; path = "Target Support Files/Pods-<%= className %>/Pods-<%= className %>.debug.xcconfig"; sourceTree = "<group>"; };
|
|
39
41
|
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
|
|
40
42
|
/* End PBXFileReference section */
|
|
41
43
|
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
isa = PBXFrameworksBuildPhase;
|
|
45
47
|
buildActionMask = 2147483647;
|
|
46
48
|
files = (
|
|
47
|
-
|
|
49
|
+
CB28F6E71BFFBBFFE4D6CA71 /* libPods-<%= className %>.a in Frameworks */,
|
|
48
50
|
);
|
|
49
51
|
runOnlyForDeploymentPostprocessing = 0;
|
|
50
52
|
};
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
isa = PBXGroup;
|
|
77
79
|
children = (
|
|
78
80
|
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
|
|
79
|
-
|
|
81
|
+
65E4FAB80E3D35EA640E54A7 /* libPods-<%= className %>.a */,
|
|
80
82
|
);
|
|
81
83
|
name = Frameworks;
|
|
82
84
|
sourceTree = "<group>";
|
|
@@ -95,7 +97,7 @@
|
|
|
95
97
|
832341AE1AAA6A7D00B99B32 /* Libraries */,
|
|
96
98
|
83CBBA001A601CBA00E9B192 /* Products */,
|
|
97
99
|
2D16E6871FA4F8E400B85C8A /* Frameworks */,
|
|
98
|
-
|
|
100
|
+
CC467A8CA32BFDD637A07875 /* Pods */,
|
|
99
101
|
);
|
|
100
102
|
indentWidth = 2;
|
|
101
103
|
sourceTree = "<group>";
|
|
@@ -110,11 +112,11 @@
|
|
|
110
112
|
name = Products;
|
|
111
113
|
sourceTree = "<group>";
|
|
112
114
|
};
|
|
113
|
-
|
|
115
|
+
CC467A8CA32BFDD637A07875 /* Pods */ = {
|
|
114
116
|
isa = PBXGroup;
|
|
115
117
|
children = (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
D06EE1839428A1A3F684470B /* Pods-<%= className %>.debug.xcconfig */,
|
|
119
|
+
56DF1300CF795902963DA15C /* Pods-<%= className %>.release.xcconfig */,
|
|
118
120
|
);
|
|
119
121
|
name = Pods;
|
|
120
122
|
path = Pods;
|
|
@@ -127,14 +129,14 @@
|
|
|
127
129
|
isa = PBXNativeTarget;
|
|
128
130
|
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "<%= className %>" */;
|
|
129
131
|
buildPhases = (
|
|
130
|
-
|
|
132
|
+
58252BD862A890A972880CBA /* [CP] Check Pods Manifest.lock */,
|
|
131
133
|
FD10A7F022414F080027D42C /* Start Packager */,
|
|
132
134
|
13B07F871A680F5B00A75B9A /* Sources */,
|
|
133
135
|
13B07F8C1A680F5B00A75B9A /* Frameworks */,
|
|
134
136
|
13B07F8E1A680F5B00A75B9A /* Resources */,
|
|
135
137
|
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
02884E84544B8E84B8B8F340 /* [CP] Embed Pods Frameworks */,
|
|
139
|
+
F0F4F71C107914435FC29DBB /* [CP] Copy Pods Resources */,
|
|
138
140
|
);
|
|
139
141
|
buildRules = (
|
|
140
142
|
);
|
|
@@ -214,24 +216,63 @@
|
|
|
214
216
|
shellPath = /bin/sh;
|
|
215
217
|
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh <%= entryFile %>\n";
|
|
216
218
|
};
|
|
217
|
-
|
|
219
|
+
02884E84544B8E84B8B8F340 /* [CP] Embed Pods Frameworks */ = {
|
|
218
220
|
isa = PBXShellScriptBuildPhase;
|
|
219
221
|
buildActionMask = 2147483647;
|
|
220
222
|
files = (
|
|
221
223
|
);
|
|
222
224
|
inputFileListPaths = (
|
|
223
|
-
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-
|
|
225
|
+
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
|
226
|
+
);
|
|
227
|
+
name = "[CP] Embed Pods Frameworks";
|
|
228
|
+
outputFileListPaths = (
|
|
229
|
+
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
|
230
|
+
);
|
|
231
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
232
|
+
shellPath = /bin/sh;
|
|
233
|
+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-frameworks.sh\"\n";
|
|
234
|
+
showEnvVarsInLog = 0;
|
|
235
|
+
};
|
|
236
|
+
0712EA5C2D09350540097B86 /* [CP] Copy Pods Resources */ = {
|
|
237
|
+
isa = PBXShellScriptBuildPhase;
|
|
238
|
+
buildActionMask = 2147483647;
|
|
239
|
+
files = (
|
|
240
|
+
);
|
|
241
|
+
inputFileListPaths = (
|
|
242
|
+
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>-<%= className %>Tests/Pods-<%= className %>-<%= className %>Tests-resources-${CONFIGURATION}-input-files.xcfilelist",
|
|
224
243
|
);
|
|
225
244
|
name = "[CP] Copy Pods Resources";
|
|
226
245
|
outputFileListPaths = (
|
|
227
|
-
"${PODS_ROOT}/Target Support Files/Pods-<%= className
|
|
246
|
+
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>-<%= className %>Tests/Pods-<%= className %>-<%= className %>Tests-resources-${CONFIGURATION}-output-files.xcfilelist",
|
|
228
247
|
);
|
|
229
248
|
runOnlyForDeploymentPostprocessing = 0;
|
|
230
249
|
shellPath = /bin/sh;
|
|
231
|
-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-<%= className
|
|
250
|
+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-<%= className %>-<%= className %>Tests/Pods-<%= className %>-<%= className %>Tests-resources.sh\"\n";
|
|
251
|
+
showEnvVarsInLog = 0;
|
|
252
|
+
};
|
|
253
|
+
44872F21BC689CC8A347F488 /* [CP] Check Pods Manifest.lock */ = {
|
|
254
|
+
isa = PBXShellScriptBuildPhase;
|
|
255
|
+
buildActionMask = 2147483647;
|
|
256
|
+
files = (
|
|
257
|
+
);
|
|
258
|
+
inputFileListPaths = (
|
|
259
|
+
);
|
|
260
|
+
inputPaths = (
|
|
261
|
+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
262
|
+
"${PODS_ROOT}/Manifest.lock",
|
|
263
|
+
);
|
|
264
|
+
name = "[CP] Check Pods Manifest.lock";
|
|
265
|
+
outputFileListPaths = (
|
|
266
|
+
);
|
|
267
|
+
outputPaths = (
|
|
268
|
+
"$(DERIVED_FILE_DIR)/Pods-<%= className %>-<%= className %>Tests-checkManifestLockResult.txt",
|
|
269
|
+
);
|
|
270
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
271
|
+
shellPath = /bin/sh;
|
|
272
|
+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
232
273
|
showEnvVarsInLog = 0;
|
|
233
274
|
};
|
|
234
|
-
|
|
275
|
+
58252BD862A890A972880CBA /* [CP] Check Pods Manifest.lock */ = {
|
|
235
276
|
isa = PBXShellScriptBuildPhase;
|
|
236
277
|
buildActionMask = 2147483647;
|
|
237
278
|
files = (
|
|
@@ -253,21 +294,21 @@
|
|
|
253
294
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
254
295
|
showEnvVarsInLog = 0;
|
|
255
296
|
};
|
|
256
|
-
|
|
297
|
+
F0F4F71C107914435FC29DBB /* [CP] Copy Pods Resources */ = {
|
|
257
298
|
isa = PBXShellScriptBuildPhase;
|
|
258
299
|
buildActionMask = 2147483647;
|
|
259
300
|
files = (
|
|
260
301
|
);
|
|
261
302
|
inputFileListPaths = (
|
|
262
|
-
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-
|
|
303
|
+
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-resources-${CONFIGURATION}-input-files.xcfilelist",
|
|
263
304
|
);
|
|
264
|
-
name = "[CP]
|
|
305
|
+
name = "[CP] Copy Pods Resources";
|
|
265
306
|
outputFileListPaths = (
|
|
266
|
-
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-
|
|
307
|
+
"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-resources-${CONFIGURATION}-output-files.xcfilelist",
|
|
267
308
|
);
|
|
268
309
|
runOnlyForDeploymentPostprocessing = 0;
|
|
269
310
|
shellPath = /bin/sh;
|
|
270
|
-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-
|
|
311
|
+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-<%= className %>/Pods-<%= className %>-resources.sh\"\n";
|
|
271
312
|
showEnvVarsInLog = 0;
|
|
272
313
|
};
|
|
273
314
|
FD10A7F022414F080027D42C /* Start Packager */ = {
|
|
@@ -314,7 +355,7 @@
|
|
|
314
355
|
/* Begin XCBuildConfiguration section */
|
|
315
356
|
13B07F941A680F5B00A75B9A /* Debug */ = {
|
|
316
357
|
isa = XCBuildConfiguration;
|
|
317
|
-
baseConfigurationReference =
|
|
358
|
+
baseConfigurationReference = D06EE1839428A1A3F684470B /* Pods-<%= className %>.debug.xcconfig */;
|
|
318
359
|
buildSettings = {
|
|
319
360
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
320
361
|
CLANG_ENABLE_MODULES = YES;
|
|
@@ -340,7 +381,7 @@
|
|
|
340
381
|
};
|
|
341
382
|
13B07F951A680F5B00A75B9A /* Release */ = {
|
|
342
383
|
isa = XCBuildConfiguration;
|
|
343
|
-
baseConfigurationReference =
|
|
384
|
+
baseConfigurationReference = 56DF1300CF795902963DA15C /* Pods-<%= className %>.release.xcconfig */;
|
|
344
385
|
buildSettings = {
|
|
345
386
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
346
387
|
CLANG_ENABLE_MODULES = YES;
|
|
@@ -355,7 +396,7 @@
|
|
|
355
396
|
"-ObjC",
|
|
356
397
|
"-lc++",
|
|
357
398
|
);
|
|
358
|
-
PRODUCT_BUNDLE_IDENTIFIER = "org.$(PRODUCT_NAME:rfc1034identifier)";
|
|
399
|
+
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
|
359
400
|
PRODUCT_NAME = <%= className %>;
|
|
360
401
|
SWIFT_VERSION = 5.0;
|
|
361
402
|
VERSIONING_SYSTEM = "apple-generic";
|
|
@@ -417,6 +458,7 @@
|
|
|
417
458
|
"$(inherited)",
|
|
418
459
|
);
|
|
419
460
|
LIBRARY_SEARCH_PATHS = (
|
|
461
|
+
"\"$(SDKROOT)/usr/lib/swift\"",
|
|
420
462
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
421
463
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
422
464
|
"\"$(inherited)\"",
|
|
@@ -475,6 +517,7 @@
|
|
|
475
517
|
"$(inherited)",
|
|
476
518
|
);
|
|
477
519
|
LIBRARY_SEARCH_PATHS = (
|
|
520
|
+
"\"$(SDKROOT)/usr/lib/swift\"",
|
|
478
521
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
479
522
|
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
480
523
|
"\"$(inherited)\"",
|
|
@@ -509,4 +552,4 @@
|
|
|
509
552
|
/* End XCConfigurationList section */
|
|
510
553
|
};
|
|
511
554
|
rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
|
|
512
|
-
}
|
|
555
|
+
}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
const { withNxMetro } = require('@nrwl/react-native');
|
|
2
|
+
const { getDefaultConfig } = require('metro-config');
|
|
2
3
|
|
|
3
|
-
module.exports =
|
|
4
|
-
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
module.exports = (async () => {
|
|
5
|
+
const {
|
|
6
|
+
resolver: { sourceExts, assetExts },
|
|
7
|
+
} = await getDefaultConfig();
|
|
8
|
+
return withNxMetro(
|
|
9
|
+
{
|
|
10
|
+
transformer: {
|
|
11
|
+
getTransformOptions: async () => ({
|
|
12
|
+
transform: {
|
|
13
|
+
experimentalImportSupport: false,
|
|
14
|
+
inlineRequires: true,
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
18
|
+
},
|
|
19
|
+
resolver: {
|
|
20
|
+
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
21
|
+
sourceExts: [...sourceExts, 'svg'],
|
|
22
|
+
},
|
|
12
23
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
);
|
|
24
|
+
{
|
|
25
|
+
// Change this to true to see debugging info.
|
|
26
|
+
// Useful if you have issues resolving modules
|
|
27
|
+
debug: false,
|
|
28
|
+
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx'
|
|
29
|
+
extensions: [],
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
})();
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"
|
|
7
|
-
"react": "*",
|
|
6
|
+
"@testing-library/jest-native": "*",
|
|
8
7
|
"@testing-library/react-native": "*",
|
|
9
|
-
"
|
|
8
|
+
"react": "*",
|
|
9
|
+
"react-native": "*",
|
|
10
|
+
"react-native-svg": "*"
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import 'react
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
3
2
|
import { render } from '@testing-library/react-native';
|
|
4
3
|
|
|
5
4
|
import App from './App';
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
test('renders correctly', () => {
|
|
8
7
|
const { getByTestId } = render(<App />);
|
|
9
8
|
expect(getByTestId('heading')).toHaveTextContent('Welcome');
|
|
10
9
|
});
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from 'react-native/Libraries/NewAppScreen';
|
|
18
18
|
// @ts-ignore
|
|
19
19
|
import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser';
|
|
20
|
+
import Star from './star.svg';
|
|
20
21
|
|
|
21
22
|
const App = () => {
|
|
22
23
|
return (
|
|
@@ -65,6 +66,22 @@ const App = () => {
|
|
|
65
66
|
about Nx.
|
|
66
67
|
</Text>
|
|
67
68
|
</TouchableOpacity>
|
|
69
|
+
|
|
70
|
+
<Text style={styles.sectionDescription}>
|
|
71
|
+
Thank you for using and showing some ♥ for Nx. If you like Nx, please give it a star:
|
|
72
|
+
</Text>
|
|
73
|
+
|
|
74
|
+
<View style={styles.githubStarContainer}>
|
|
75
|
+
<TouchableOpacity
|
|
76
|
+
style={styles.githubStarBadge}
|
|
77
|
+
onPress={() =>
|
|
78
|
+
openURLInBrowser('https://github.com/nrwl/nx')
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
<Star width={24} height={24} fill={Colors.dark} />
|
|
82
|
+
<Text> Star</Text>
|
|
83
|
+
</TouchableOpacity>
|
|
84
|
+
</View>
|
|
68
85
|
</View>
|
|
69
86
|
</View>
|
|
70
87
|
</ScrollView>
|
|
@@ -126,6 +143,23 @@ const styles = StyleSheet.create({
|
|
|
126
143
|
link: {
|
|
127
144
|
color: '#45bc98',
|
|
128
145
|
},
|
|
146
|
+
githubStarContainer: {
|
|
147
|
+
display: 'flex',
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
padding: 10,
|
|
151
|
+
},
|
|
152
|
+
githubStarBadge: {
|
|
153
|
+
borderWidth: 1,
|
|
154
|
+
borderColor: Colors.dark,
|
|
155
|
+
borderRadius: 3,
|
|
156
|
+
display: 'flex',
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
paddingHorizontal: 10,
|
|
160
|
+
paddingVertical: 3,
|
|
161
|
+
fontWeight: '600',
|
|
162
|
+
}
|
|
129
163
|
});
|
|
130
164
|
|
|
131
165
|
export default App;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg
|
|
3
|
+
className="material-icons"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="24"
|
|
6
|
+
height="24"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
>
|
|
9
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
10
|
+
<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" />
|
|
11
|
+
</svg>
|
|
@@ -46,8 +46,9 @@ function updateDependencies(host) {
|
|
|
46
46
|
'jest-react-native': versions_1.jestReactNativeVersion,
|
|
47
47
|
metro: versions_1.metroVersion,
|
|
48
48
|
'metro-resolver': versions_1.metroVersion,
|
|
49
|
-
'react-native-codegen': versions_1.reactNativeCodegenVersion,
|
|
50
49
|
'react-test-renderer': versions_1.reactTestRendererVersion,
|
|
50
|
+
'react-native-svg-transformer': versions_1.reactNativeSvgTransformerVersion,
|
|
51
|
+
'react-native-svg': versions_1.reactNativeSvgVersion,
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
exports.updateDependencies = updateDependencies;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,iGAA4F;AAC5F,yCAMsB;AAEtB,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,iGAA4F;AAC5F,yCAMsB;AAEtB,mDAiB8B;AAC9B,2FAAqF;AACrF,qEAA+D;AAC/D,qCAA+C;AAC/C,uCAAiD;AAEjD,SAAsB,wBAAwB,CAAC,IAAU,EAAE,MAAc;;QACvE,6CAAoB,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QACjD,wCAAiB,CAAC,IAAI,CAAC,CAAC;QAExB,MAAM,KAAK,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/D,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,EAAE;YAC9D,MAAM,QAAQ,GAAG,wBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QAED,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,KAAK,OAAO,EAAE;YAC7D,MAAM,SAAS,GAAG,MAAM,0BAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACvB;QAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,oBAAW,CAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,sCAAgB,CAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AArBD,4DAqBC;AAED,SAAgB,kBAAkB,CAAC,IAAU;IAC3C,OAAO,qCAA4B,CACjC,IAAI,EACJ;QACE,KAAK,EAAE,uBAAY;QACnB,cAAc,EAAE,6BAAkB;KACnC,EACD;QACE,oBAAoB,EAAE,oBAAS;QAC/B,cAAc,EAAE,4BAAiB;QACjC,qBAAqB,EAAE,kCAAuB;QAC9C,6BAA6B,EAAE,kCAAuB;QACtD,8CAA8C,EAC5C,yCAA8B;QAChC,0CAA0C,EAAE,qCAA0B;QACtE,iCAAiC,EAAE,6CAAkC;QACrE,+BAA+B,EAAE,2CAAgC;QACjE,8BAA8B,EAAE,0CAA+B;QAC/D,mBAAmB,EAAE,iCAAsB;QAC3C,KAAK,EAAE,uBAAY;QACnB,gBAAgB,EAAE,uBAAY;QAC9B,qBAAqB,EAAE,mCAAwB;QAC/C,8BAA8B,EAAE,2CAAgC;QAChE,kBAAkB,EAAE,gCAAqB;KAC1C,CACF,CAAC;AACJ,CAAC;AA1BD,gDA0BC;AAED,SAAS,cAAc,CAAC,IAAU;IAChC,OAAO,0CAAiC,CAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,kBAAe,wBAAwB,CAAC;AAC3B,QAAA,wBAAwB,GAAG,2BAAkB,CACxD,wBAAwB,CACzB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tree } from '@nrwl/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Add support to display svg in react native:
|
|
4
|
+
* - Add react-native-svg-transform and react-native-svg packages to workspace's package.json.
|
|
5
|
+
* - Add typing to app's tsconfig.json.
|
|
6
|
+
* - Add react-native-svg to app's package.json.
|
|
7
|
+
*/
|
|
8
|
+
export default function update(tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
/**
|
|
6
|
+
* Add support to display svg in react native:
|
|
7
|
+
* - Add react-native-svg-transform and react-native-svg packages to workspace's package.json.
|
|
8
|
+
* - Add typing to app's tsconfig.json.
|
|
9
|
+
* - Add react-native-svg to app's package.json.
|
|
10
|
+
*/
|
|
11
|
+
function update(tree) {
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const projects = devkit_1.getProjects(tree);
|
|
14
|
+
projects.forEach((project) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
if (((_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/react-native:start')
|
|
17
|
+
return;
|
|
18
|
+
addReactNativeSvgToAppPackageJson(tree, project);
|
|
19
|
+
addReactNativeSvgToTsconfig(tree, project);
|
|
20
|
+
mockSvgInJestConfig(tree, project);
|
|
21
|
+
});
|
|
22
|
+
yield devkit_1.formatFiles(tree);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.default = update;
|
|
26
|
+
function addReactNativeSvgToAppPackageJson(host, project) {
|
|
27
|
+
const packageJSonPath = `${project.root}/package.json`;
|
|
28
|
+
if (!host.exists(packageJSonPath))
|
|
29
|
+
return;
|
|
30
|
+
devkit_1.updateJson(host, packageJSonPath, (json) => {
|
|
31
|
+
const dependencies = json.dependencies || {};
|
|
32
|
+
dependencies['react-native-svg'] = '*';
|
|
33
|
+
return json;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function addReactNativeSvgToTsconfig(host, project) {
|
|
37
|
+
const tsconfigPath = `${project.root}/tsconfig.json`;
|
|
38
|
+
if (!host.exists(tsconfigPath))
|
|
39
|
+
return;
|
|
40
|
+
const offset = devkit_1.offsetFromRoot(project.root);
|
|
41
|
+
devkit_1.updateJson(host, tsconfigPath, (json) => {
|
|
42
|
+
const files = json.files || [];
|
|
43
|
+
files.push(`${offset}node_modules/@nrwl/react/typings/image.d.ts`);
|
|
44
|
+
json.files = files;
|
|
45
|
+
return json;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function mockSvgInJestConfig(host, project) {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
const jestConfigPath = (_c = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.test) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.jestConfig;
|
|
51
|
+
if (!jestConfigPath || !host.exists(jestConfigPath))
|
|
52
|
+
return;
|
|
53
|
+
try {
|
|
54
|
+
const contents = host.read(jestConfigPath, 'utf-8');
|
|
55
|
+
if (contents.includes('moduleNameMapper'))
|
|
56
|
+
return;
|
|
57
|
+
host.write(jestConfigPath, contents.replace(/,([^,]*)$/, `, moduleNameMapper: {'\\.svg': '@nrwl/react-native/plugins/jest/svg-mock'}, $1`));
|
|
58
|
+
}
|
|
59
|
+
catch (_d) {
|
|
60
|
+
devkit_1.logger.error(devkit_1.stripIndents `Unable to update ${jestConfigPath} for project ${project.root}.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=add-react-native-svg-12-10-0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-react-native-svg-12-10-0.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.ts"],"names":[],"mappings":";;;AAAA,yCASsB;AAEtB;;;;;GAKG;AACH,SAA8B,MAAM,CAAC,IAAU;;QAC7C,MAAM,QAAQ,GAAG,oBAAW,CAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;;YAC3B,IAAI,CAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,0CAAE,QAAQ,MAAK,0BAA0B;gBAAE,OAAO;YAE5E,iCAAiC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACjD,2BAA2B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC3C,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,MAAM,oBAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAZD,yBAYC;AAED,SAAS,iCAAiC,CACxC,IAAU,EACV,OAA6B;IAE7B,MAAM,eAAe,GAAG,GAAG,OAAO,CAAC,IAAI,eAAe,CAAC;IACvD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;QAAE,OAAO;IAC1C,mBAAU,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;QACzC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;QAC7C,YAAY,CAAC,kBAAkB,CAAC,GAAG,GAAG,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,2BAA2B,CAClC,IAAU,EACV,OAA6B;IAE7B,MAAM,YAAY,GAAG,GAAG,OAAO,CAAC,IAAI,gBAAgB,CAAC;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QAAE,OAAO;IACvC,MAAM,MAAM,GAAG,uBAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,mBAAU,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,6CAA6C,CAAC,CAAC;QACnE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAU,EAAE,OAA6B;;IACpE,MAAM,cAAc,GAAG,MAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,0CAAE,OAAO,0CAAE,UAAU,CAAC;IAClE,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAAE,OAAO;IAC5D,IAAI;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAAE,OAAO;QAClD,IAAI,CAAC,KAAK,CACR,cAAc,EACd,QAAQ,CAAC,OAAO,CACd,WAAW,EACX,gFAAgF,CACjF,CACF,CAAC;KACH;IAAC,WAAM;QACN,eAAM,CAAC,KAAK,CACV,qBAAY,CAAA,oBAAoB,cAAc,gBAAgB,OAAO,CAAC,IAAI,GAAG,CAC9E,CAAC;KACH;AACH,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
|
|
2
|
+
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
|
3
|
+
import {
|
|
4
|
+
reactNativeSvgTransformerVersion,
|
|
5
|
+
reactNativeSvgVersion,
|
|
6
|
+
} from '../../utils/versions';
|
|
7
|
+
import update from './add-react-native-svg-12-10-0';
|
|
8
|
+
|
|
9
|
+
describe('Add react-native-svg to dev dependencies', () => {
|
|
10
|
+
let tree: Tree;
|
|
11
|
+
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
tree = createTreeWithEmptyWorkspace();
|
|
14
|
+
addProjectConfiguration(tree, 'products', {
|
|
15
|
+
root: 'apps/products',
|
|
16
|
+
sourceRoot: 'apps/products/src',
|
|
17
|
+
targets: {
|
|
18
|
+
start: {
|
|
19
|
+
executor: '@nrwl/react-native:start',
|
|
20
|
+
options: {
|
|
21
|
+
port: 8081,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
test: {
|
|
25
|
+
executor: '@nrwl/jest:jest',
|
|
26
|
+
options: {
|
|
27
|
+
jestConfig: 'apps/products/jest.config.js',
|
|
28
|
+
passWithNoTests: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it(`should add react-native-svg to app's tsconfig.json and package.json`, async () => {
|
|
36
|
+
tree.write('apps/products/tsconfig.json', '{}');
|
|
37
|
+
tree.write(
|
|
38
|
+
'apps/products/package.json',
|
|
39
|
+
JSON.stringify({
|
|
40
|
+
dependencies: {},
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
tree.write(
|
|
44
|
+
'apps/products/jest.config.js',
|
|
45
|
+
`module.exports = {
|
|
46
|
+
preset: 'react-native',
|
|
47
|
+
};`
|
|
48
|
+
);
|
|
49
|
+
await update(tree);
|
|
50
|
+
|
|
51
|
+
const tsconfig = readJson(tree, 'apps/products/tsconfig.json');
|
|
52
|
+
expect(tsconfig.files).toEqual([
|
|
53
|
+
'../../node_modules/@nrwl/react/typings/image.d.ts',
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
const packageJson = readJson(tree, 'apps/products/package.json');
|
|
57
|
+
expect(packageJson.dependencies).toEqual({ 'react-native-svg': '*' });
|
|
58
|
+
|
|
59
|
+
const jestConfig = tree.read('apps/products/jest.config.js', 'utf-8');
|
|
60
|
+
expect(jestConfig).toContain(
|
|
61
|
+
`moduleNameMapper: {'\\.svg': '@nrwl/react-native/plugins/jest/svg-mock'},`
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it(`should not add react-native-svg to app's tsconfig.json and package.json if files do not exist`, async () => {
|
|
66
|
+
tree.write(
|
|
67
|
+
'package.json',
|
|
68
|
+
JSON.stringify({
|
|
69
|
+
dependencies: { 'react-native': '*' },
|
|
70
|
+
devDependencies: {},
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
await update(tree);
|
|
75
|
+
|
|
76
|
+
expect(() => readJson(tree, 'apps/products/tsconfig.json')).toThrow();
|
|
77
|
+
expect(() => readJson(tree, 'apps/products/package.json')).toThrow();
|
|
78
|
+
});
|
|
79
|
+
});
|
package/src/utils/add-jest.js
CHANGED
|
@@ -20,9 +20,13 @@ function addJest(host, unitTestRunner, projectName, appProjectRoot) {
|
|
|
20
20
|
const content = `module.exports = {
|
|
21
21
|
displayName: '${projectName}',
|
|
22
22
|
preset: 'react-native',
|
|
23
|
+
testRunner: 'jest-jasmine2',
|
|
23
24
|
resolver: '@nrwl/jest/plugins/resolver',
|
|
24
25
|
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
|
|
25
26
|
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
|
27
|
+
moduleNameMapper: {
|
|
28
|
+
'\\.svg': '@nrwl/react-native/plugins/jest/svg-mock'
|
|
29
|
+
},
|
|
26
30
|
transform: {
|
|
27
31
|
'\\\\.(js|ts|tsx)$': require.resolve('react-native/jest/preprocessor.js'),
|
|
28
32
|
'^.+\\\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../packages/react-native/src/utils/add-jest.ts"],"names":[],"mappings":";;;;AACA,qCAAkD;AAElD,SAAsB,OAAO,CAC3B,IAAU,EACV,cAA+B,EAC/B,WAAmB,EACnB,cAAsB;;QAEtB,IAAI,cAAc,KAAK,MAAM,EAAE;YAC7B,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,QAAQ,GAAG,MAAM,2BAAoB,CAAC,IAAI,EAAE;YAChD,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,kGAAkG;QAClG,MAAM,UAAU,GAAG,GAAG,cAAc,iBAAiB,CAAC;QACtD,MAAM,OAAO,GAAG;kBACA,WAAW
|
|
1
|
+
{"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../packages/react-native/src/utils/add-jest.ts"],"names":[],"mappings":";;;;AACA,qCAAkD;AAElD,SAAsB,OAAO,CAC3B,IAAU,EACV,cAA+B,EAC/B,WAAmB,EACnB,cAAsB;;QAEtB,IAAI,cAAc,KAAK,MAAM,EAAE;YAC7B,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,QAAQ,GAAG,MAAM,2BAAoB,CAAC,IAAI,EAAE;YAChD,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,kGAAkG;QAClG,MAAM,UAAU,GAAG,GAAG,cAAc,iBAAiB,CAAC;QACtD,MAAM,OAAO,GAAG;kBACA,WAAW;;;;;;;;;;;;;;;GAe1B,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAEhC,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAxCD,0BAwCC"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const nxVersion = "*";
|
|
2
2
|
export declare const reactVersion = "17.0.2";
|
|
3
3
|
export declare const typesReactVersion = "17.0.19";
|
|
4
|
-
export declare const reactNativeVersion = "0.
|
|
5
|
-
export declare const typesReactNativeVersion = "0.
|
|
4
|
+
export declare const reactNativeVersion = "0.66.0";
|
|
5
|
+
export declare const typesReactNativeVersion = "0.65.3";
|
|
6
6
|
export declare const metroVersion = "0.66.2";
|
|
7
7
|
export declare const reactNativeCommunityCli = "6.0.0";
|
|
8
8
|
export declare const reactNativeCommunityCliIos = "6.0.0";
|
|
@@ -12,4 +12,5 @@ export declare const testingLibraryReactNativeVersion = "8.0.0-rc.0";
|
|
|
12
12
|
export declare const testingLibraryJestNativeVersion = "4.0.2";
|
|
13
13
|
export declare const jestReactNativeVersion = "18.0.0";
|
|
14
14
|
export declare const reactTestRendererVersion = "17.0.2";
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const reactNativeSvgTransformerVersion = "0.14.3";
|
|
16
|
+
export declare const reactNativeSvgVersion = "12.1.1";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.nxVersion = '12.10.0-beta.
|
|
3
|
+
exports.reactNativeSvgVersion = exports.reactNativeSvgTransformerVersion = exports.reactTestRendererVersion = exports.jestReactNativeVersion = exports.testingLibraryJestNativeVersion = exports.testingLibraryReactNativeVersion = exports.metroReactNativeBabelPresetVersion = exports.reactNativeCommunityCliAndroid = exports.reactNativeCommunityCliIos = exports.reactNativeCommunityCli = exports.metroVersion = exports.typesReactNativeVersion = exports.reactNativeVersion = exports.typesReactVersion = exports.reactVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.nxVersion = '12.10.0-beta.6';
|
|
5
5
|
exports.reactVersion = '17.0.2';
|
|
6
6
|
exports.typesReactVersion = '17.0.19';
|
|
7
|
-
exports.reactNativeVersion = '0.
|
|
8
|
-
exports.typesReactNativeVersion = '0.
|
|
7
|
+
exports.reactNativeVersion = '0.66.0';
|
|
8
|
+
exports.typesReactNativeVersion = '0.65.3';
|
|
9
9
|
exports.metroVersion = '0.66.2';
|
|
10
10
|
exports.reactNativeCommunityCli = '6.0.0';
|
|
11
11
|
exports.reactNativeCommunityCliIos = '6.0.0';
|
|
@@ -15,5 +15,6 @@ exports.testingLibraryReactNativeVersion = '8.0.0-rc.0';
|
|
|
15
15
|
exports.testingLibraryJestNativeVersion = '4.0.2';
|
|
16
16
|
exports.jestReactNativeVersion = '18.0.0';
|
|
17
17
|
exports.reactTestRendererVersion = '17.0.2';
|
|
18
|
-
exports.
|
|
18
|
+
exports.reactNativeSvgTransformerVersion = '0.14.3';
|
|
19
|
+
exports.reactNativeSvgVersion = '12.1.1';
|
|
19
20
|
//# sourceMappingURL=versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/react-native/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,GAAG,CAAC;AAEhB,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE9B,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/react-native/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,GAAG,CAAC;AAEhB,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE9B,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AAEnC,QAAA,YAAY,GAAG,QAAQ,CAAC;AAExB,QAAA,uBAAuB,GAAG,OAAO,CAAC;AAClC,QAAA,0BAA0B,GAAG,OAAO,CAAC;AACrC,QAAA,8BAA8B,GAAG,OAAO,CAAC;AAEzC,QAAA,kCAAkC,GAAG,QAAQ,CAAC;AAE9C,QAAA,gCAAgC,GAAG,YAAY,CAAC;AAChD,QAAA,+BAA+B,GAAG,OAAO,CAAC;AAE1C,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAElC,QAAA,wBAAwB,GAAG,QAAQ,CAAC;AAEpC,QAAA,gCAAgC,GAAG,QAAQ,CAAC;AAC5C,QAAA,qBAAqB,GAAG,QAAQ,CAAC"}
|