@nrwl/react-native 13.4.5 → 13.5.0-beta.2
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/README.md +2 -74
- package/executors.json +4 -4
- package/generators.json +6 -6
- package/migrations.json +54 -0
- package/package.json +8 -8
- package/plugins/jest/svg-mock.js +0 -1
- package/plugins/jest/svg-mock.js.map +1 -1
- package/project.json +10 -5
- package/src/generators/application/files/app/android/app/build.gradle.template +2 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +1 -0
- package/src/generators/application/files/app/android/settings.gradle.template +3 -0
- package/src/generators/application/files/app/package.json.template +1 -0
- package/src/generators/application/files/app/src/app/App.tsx.template +2 -2
- package/src/generators/application/files/app/tsconfig.app.json.template +1 -1
- package/src/generators/application/files/app/tsconfig.json.template +1 -1
- package/src/generators/init/init.js +10 -8
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/init.spec.ts +31 -0
- package/src/generators/init/lib/add-git-ignore-entry.js +2 -3
- package/src/generators/init/lib/add-git-ignore-entry.js.map +1 -1
- package/src/generators/init/lib/init-root-babel-config.d.ts +2 -0
- package/src/generators/init/lib/init-root-babel-config.js +14 -0
- package/src/generators/init/lib/init-root-babel-config.js.map +1 -0
- package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +1 -1
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js +1 -1
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js.map +1 -1
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.spec.ts +1 -1
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.d.ts +2 -0
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js +26 -0
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js.map +1 -0
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.spec.ts +48 -0
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.d.ts +6 -0
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.js +41 -0
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.js.map +1 -0
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.spec.ts +61 -0
- package/src/utils/find-all-npm-dependencies.spec.ts +17 -9
- package/src/utils/versions.d.ts +9 -8
- package/src/utils/versions.js +11 -10
- package/src/utils/versions.js.map +1 -1
- package/typings/svg.d.ts +7 -0
package/README.md
CHANGED
|
@@ -17,81 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
# React Native Plugin for Nx
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
🔎 **Smart, Fast and Extensible Build System**
|
|
23
|
-
|
|
24
|
-
Nx is a smart, fast and extensible build system. It comes with first class monorepo support and powerful integrations.
|
|
25
|
-
|
|
26
|
-
### Best-in-Class Support for Monorepos
|
|
27
|
-
|
|
28
|
-
<strong>Nx</strong> provides distributed graph-based task execution and computation caching.
|
|
29
|
-
|
|
30
|
-
<strong>Nx</strong> is smart. It analyzes your workspace and figures out what can be affected by every code change.
|
|
31
|
-
That's why Nx doesn't rebuild and retest everything on every commit--<strong>it only rebuilds what is necessary</strong>
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
<strong>Nx</strong> partitions commands into a graph of smaller tasks. Nx then runs those tasks in parallel,
|
|
35
|
-
and <strong>it can even distribute them across multiple machines without any configuration</strong>.
|
|
36
|
-
|
|
37
|
-
<strong>Nx also uses a distributed computation cache.</strong> If someone has already built or tested similar code, Nx
|
|
38
|
-
will use their results to speed up the command for everyone else.
|
|
39
|
-
|
|
40
|
-
### Holistic Dev Experience Powered by an Advanced CLI and Editor Plugins
|
|
41
|
-
|
|
42
|
-
<strong>Nx</strong> helps scale your development from one team building one application to many teams building multiple
|
|
43
|
-
frontend and backend applications all in the same workspace. <strong >When using Nx, developers have a holistic dev
|
|
44
|
-
experience powered by an advanced CLI</strong > (with editor plugins), capabilities for controlled code sharing and
|
|
45
|
-
consistent code generation.
|
|
46
|
-
|
|
47
|
-
### Rich Plugin Ecosystem
|
|
48
|
-
|
|
49
|
-
<strong>Nx</strong> is an open platform with plugins for many modern tools and frameworks. It has support for
|
|
50
|
-
TypeScript, React, Angular, Cypress, Jest, Prettier, Nest.js, Next.js, Storybook, Ionic among others. With Nx, you get a
|
|
51
|
-
consistent dev experience regardless of the tools used.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Getting Started
|
|
55
|
-
|
|
56
|
-
### Creating an Nx Workspace
|
|
57
|
-
|
|
58
|
-
**Using `npx`**
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npx create-nx-workspace
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**Using `npm init`**
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npm init nx-workspace
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Using `yarn create`**
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
yarn create nx-workspace
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
The `create-nx-workspace` command will ask you to select a preset, which will configure some plugins and create your applications to help you get started.
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
? What to create in the new workspace (Use arrow keys)
|
|
80
|
-
❯ empty [an empty workspace with a layout that works best for building apps]
|
|
81
|
-
npm [an empty workspace set up to publish npm packages (similar to and compatible with yarn workspaces)]
|
|
82
|
-
react [a workspace with a single React application]
|
|
83
|
-
angular [a workspace with a single Angular application]
|
|
84
|
-
next.js [a workspace with a single Next.js application]
|
|
85
|
-
gatsby [a workspace with a single Gatsby application]
|
|
86
|
-
nest [a workspace with a single Nest application]
|
|
87
|
-
express [a workspace with a single Express application]
|
|
88
|
-
web components [a workspace with a single app built using web components]
|
|
89
|
-
react-express [a workspace with a full stack application (React + Express)]
|
|
90
|
-
angular-nest [a workspace with a full stack application (Angular + Nest)]
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Select the preset that works best for you.
|
|
20
|
+
{{what-is-nx}}
|
|
94
21
|
|
|
22
|
+
{{getting-started}}
|
|
95
23
|
|
|
96
24
|
## Table of Contents
|
|
97
25
|
|
package/executors.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"bundle": {
|
|
14
14
|
"implementation": "./src/executors/bundle/bundle.impl",
|
|
15
15
|
"schema": "./src/executors/bundle/schema.json",
|
|
16
|
-
"description": "Builds the
|
|
16
|
+
"description": "Builds the JavaScript bundle for offline use."
|
|
17
17
|
},
|
|
18
18
|
"build-android": {
|
|
19
19
|
"implementation": "./src/executors/build-android/build-android.impl",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"start": {
|
|
24
24
|
"implementation": "./src/executors/start/start.impl",
|
|
25
25
|
"schema": "./src/executors/start/schema.json",
|
|
26
|
-
"description": "Starts the
|
|
26
|
+
"description": "Starts the Javascript server that communicates with connected devices."
|
|
27
27
|
},
|
|
28
28
|
"sync-deps": {
|
|
29
29
|
"implementation": "./src/executors/sync-deps/sync-deps.impl",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"bundle": {
|
|
51
51
|
"implementation": "./src/executors/bundle/compat",
|
|
52
52
|
"schema": "./src/executors/bundle/schema.json",
|
|
53
|
-
"description": "Builds the
|
|
53
|
+
"description": "Builds the JavaScript bundle for offline use."
|
|
54
54
|
},
|
|
55
55
|
"build-android": {
|
|
56
56
|
"implementation": "./src/executors/build-android/compat",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"start": {
|
|
61
61
|
"implementation": "./src/executors/start/compat",
|
|
62
62
|
"schema": "./src/executors/start/schema.json",
|
|
63
|
-
"description": "Starts the
|
|
63
|
+
"description": "Starts the Javascript server that communicates with connected devices."
|
|
64
64
|
},
|
|
65
65
|
"sync-deps": {
|
|
66
66
|
"implementation": "./src/executors/sync-deps/compat",
|
package/generators.json
CHANGED
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"schema": "./src/generators/application/schema.json",
|
|
15
15
|
"aliases": ["app"],
|
|
16
16
|
"x-type": "application",
|
|
17
|
-
"description": "Create
|
|
17
|
+
"description": "Create a React Native application"
|
|
18
18
|
},
|
|
19
19
|
"library": {
|
|
20
20
|
"factory": "./src/generators/library/library#reactNativeLibrarySchematic",
|
|
21
21
|
"schema": "./src/generators/library/schema.json",
|
|
22
22
|
"aliases": ["lib"],
|
|
23
23
|
"x-type": "library",
|
|
24
|
-
"description": "Create a library"
|
|
24
|
+
"description": "Create a React Native library"
|
|
25
25
|
},
|
|
26
26
|
"component": {
|
|
27
27
|
"factory": "./src/generators/component/component#reactNativeComponentSchematic",
|
|
28
28
|
"schema": "./src/generators/component/schema.json",
|
|
29
|
-
"description": "Create a component",
|
|
29
|
+
"description": "Create a React Native component",
|
|
30
30
|
"aliases": ["c"]
|
|
31
31
|
}
|
|
32
32
|
},
|
|
@@ -42,19 +42,19 @@
|
|
|
42
42
|
"schema": "./src/generators/application/schema.json",
|
|
43
43
|
"aliases": ["app"],
|
|
44
44
|
"x-type": "application",
|
|
45
|
-
"description": "Create
|
|
45
|
+
"description": "Create a React Native application"
|
|
46
46
|
},
|
|
47
47
|
"library": {
|
|
48
48
|
"factory": "./src/generators/library/library#reactNativeLibraryGenerator",
|
|
49
49
|
"schema": "./src/generators/library/schema.json",
|
|
50
50
|
"aliases": ["lib"],
|
|
51
51
|
"x-type": "library",
|
|
52
|
-
"description": "Create a library"
|
|
52
|
+
"description": "Create a React Native library"
|
|
53
53
|
},
|
|
54
54
|
"component": {
|
|
55
55
|
"factory": "./src/generators/component/component#reactNativeComponentGenerator",
|
|
56
56
|
"schema": "./src/generators/component/schema.json",
|
|
57
|
-
"description": "Create a component",
|
|
57
|
+
"description": "Create a React Native component",
|
|
58
58
|
"aliases": ["c"]
|
|
59
59
|
}
|
|
60
60
|
}
|
package/migrations.json
CHANGED
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
"cli": "nx",
|
|
12
12
|
"description": "Add support to display svg in react native",
|
|
13
13
|
"factory": "./src/migrations/update-12-10-0/add-react-native-svg-12-10-0"
|
|
14
|
+
},
|
|
15
|
+
"update-react-native-typing-svg-13-5-0": {
|
|
16
|
+
"version": "13.5.0-beta.0",
|
|
17
|
+
"cli": "nx",
|
|
18
|
+
"description": "Update typing for svg in react native",
|
|
19
|
+
"factory": "./src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0"
|
|
20
|
+
},
|
|
21
|
+
"add-babel-config-root-13-5-0": {
|
|
22
|
+
"version": "13.5.0-beta.0",
|
|
23
|
+
"cli": "nx",
|
|
24
|
+
"description": "Add babel.config.json at root for react native workspace if it does not exist",
|
|
25
|
+
"factory": "./src/migrations/update-13-5-0/add-babel-config-root-13-5-0"
|
|
14
26
|
}
|
|
15
27
|
},
|
|
16
28
|
"packageJsonUpdates": {
|
|
@@ -279,6 +291,48 @@
|
|
|
279
291
|
"alwaysAddToPackageJson": false
|
|
280
292
|
}
|
|
281
293
|
}
|
|
294
|
+
},
|
|
295
|
+
"13.5.0": {
|
|
296
|
+
"version": "13.5.0-beta.0",
|
|
297
|
+
"packages": {
|
|
298
|
+
"react-native": {
|
|
299
|
+
"version": "0.66.4",
|
|
300
|
+
"alwaysAddToPackageJson": false
|
|
301
|
+
},
|
|
302
|
+
"@types/react-native": {
|
|
303
|
+
"version": "0.66.11",
|
|
304
|
+
"alwaysAddToPackageJson": false
|
|
305
|
+
},
|
|
306
|
+
"@react-native-community/cli": {
|
|
307
|
+
"version": "6.3.1",
|
|
308
|
+
"alwaysAddToPackageJson": false
|
|
309
|
+
},
|
|
310
|
+
"@react-native-community/cli-platform-android": {
|
|
311
|
+
"version": "6.3.0",
|
|
312
|
+
"alwaysAddToPackageJson": false
|
|
313
|
+
},
|
|
314
|
+
"@react-native-community/cli-platform-ios": {
|
|
315
|
+
"version": "6.2.0",
|
|
316
|
+
"alwaysAddToPackageJson": false
|
|
317
|
+
},
|
|
318
|
+
"@testing-library/react-native": {
|
|
319
|
+
"version": "9.0.0",
|
|
320
|
+
"alwaysAddToPackageJson": false
|
|
321
|
+
},
|
|
322
|
+
"react-native-svg-transformer": {
|
|
323
|
+
"version": "1.0.0",
|
|
324
|
+
"alwaysAddToPackageJson": false
|
|
325
|
+
},
|
|
326
|
+
"@babel/runtime": {
|
|
327
|
+
"version": "7.16.7",
|
|
328
|
+
"alwaysAddToPackageJson": false
|
|
329
|
+
},
|
|
330
|
+
"react-native-config": {
|
|
331
|
+
"version": "1.4.5",
|
|
332
|
+
"alwaysAddToPackageJson": false,
|
|
333
|
+
"addToPackageJson": "devDependencies"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
282
336
|
}
|
|
283
337
|
}
|
|
284
338
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react-native",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.5.0-beta.2",
|
|
4
4
|
"description": "React Native Plugin for Nx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Monorepo",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"main": "index.js",
|
|
25
25
|
"types": "index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nrwl/detox": "13.
|
|
28
|
-
"@nrwl/devkit": "13.
|
|
29
|
-
"@nrwl/jest": "13.
|
|
30
|
-
"@nrwl/linter": "13.
|
|
31
|
-
"@nrwl/react": "13.
|
|
32
|
-
"@nrwl/workspace": "13.
|
|
27
|
+
"@nrwl/detox": "13.5.0-beta.2",
|
|
28
|
+
"@nrwl/devkit": "13.5.0-beta.2",
|
|
29
|
+
"@nrwl/jest": "13.5.0-beta.2",
|
|
30
|
+
"@nrwl/linter": "13.5.0-beta.2",
|
|
31
|
+
"@nrwl/react": "13.5.0-beta.2",
|
|
32
|
+
"@nrwl/workspace": "13.5.0-beta.2",
|
|
33
33
|
"chalk": "^4.1.0",
|
|
34
34
|
"enhanced-resolve": "^5.8.3",
|
|
35
35
|
"fs-extra": "^9.1.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"tsconfig-paths": "^3.9.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"react-native": "^0.66.
|
|
42
|
+
"react-native": "^0.66.4"
|
|
43
43
|
},
|
|
44
44
|
"builders": "./executors.json",
|
|
45
45
|
"ng-update": {
|
package/plugins/jest/svg-mock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg-mock.js","sourceRoot":"","sources":["../../../../../packages/react-native/plugins/jest/svg-mock.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,
|
|
1
|
+
{"version":3,"file":"svg-mock.js","sourceRoot":"","sources":["../../../../../packages/react-native/plugins/jest/svg-mock.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;AAC3B,MAAM,CAAC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC"}
|
package/project.json
CHANGED
|
@@ -44,20 +44,25 @@
|
|
|
44
44
|
"output": "/"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
"input": "
|
|
47
|
+
"input": "packages/react-native/src",
|
|
48
48
|
"glob": "**/*.!(ts)",
|
|
49
|
-
"output": "
|
|
49
|
+
"output": "/src"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
|
-
"input": "
|
|
52
|
+
"input": "packages/react-native",
|
|
53
53
|
"glob": "*.rb",
|
|
54
|
-
"output": "
|
|
54
|
+
"output": "/"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
"input": "
|
|
57
|
+
"input": "packages/react-native",
|
|
58
58
|
"glob": "**/*.json",
|
|
59
59
|
"ignore": ["**/tsconfig*.json"],
|
|
60
60
|
"output": "/"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"input": "packages/react-native",
|
|
64
|
+
"glob": "**/*.d.ts",
|
|
65
|
+
"output": "/"
|
|
61
66
|
}
|
|
62
67
|
]
|
|
63
68
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
apply plugin: "com.android.application"
|
|
2
|
+
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
|
|
2
3
|
|
|
3
4
|
import com.android.build.OutputFile
|
|
4
5
|
|
|
@@ -208,6 +209,7 @@ dependencies {
|
|
|
208
209
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
209
210
|
//noinspection GradleDynamicVersion
|
|
210
211
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
212
|
+
implementation project(':react-native-config')
|
|
211
213
|
|
|
212
214
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
|
213
215
|
|
|
@@ -4,6 +4,7 @@ import android.app.Application;
|
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
import com.facebook.react.PackageList;
|
|
6
6
|
import com.facebook.react.ReactApplication;
|
|
7
|
+
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
|
|
7
8
|
import com.facebook.react.ReactInstanceManager;
|
|
8
9
|
import com.facebook.react.ReactNativeHost;
|
|
9
10
|
import com.facebook.react.ReactPackage;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
rootProject.name = '<%= className %>'
|
|
2
2
|
|
|
3
|
+
include ':react-native-config'
|
|
4
|
+
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-config/android')
|
|
5
|
+
|
|
3
6
|
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
|
|
4
7
|
applyNativeModulesSettingsGradle(settings)
|
|
5
8
|
|
|
@@ -75,7 +75,7 @@ const App = () => {
|
|
|
75
75
|
</View>
|
|
76
76
|
</View>
|
|
77
77
|
<View style={styles.section}>
|
|
78
|
-
<View style={[styles.
|
|
78
|
+
<View style={[styles.shadowBox]}>
|
|
79
79
|
<Text style={[styles.marginBottomMd, styles.textLg]}>
|
|
80
80
|
Learning materials
|
|
81
81
|
</Text>
|
|
@@ -371,7 +371,7 @@ const styles = StyleSheet.create({
|
|
|
371
371
|
},
|
|
372
372
|
monospace: {
|
|
373
373
|
color: '#ffffff',
|
|
374
|
-
fontFamily: 'Courier',
|
|
374
|
+
fontFamily: 'Courier New',
|
|
375
375
|
marginVertical: 4,
|
|
376
376
|
},
|
|
377
377
|
comment: {
|
|
@@ -4,16 +4,18 @@ exports.reactNativeInitSchematic = exports.updateDependencies = exports.reactNat
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const set_default_collection_1 = require("@nrwl/workspace/src/utilities/set-default-collection");
|
|
6
6
|
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
-
const versions_1 = require("../../utils/versions");
|
|
8
7
|
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
9
|
-
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
10
8
|
const jest_1 = require("@nrwl/jest");
|
|
11
9
|
const detox_1 = require("@nrwl/detox");
|
|
12
|
-
const
|
|
10
|
+
const versions_1 = require("@nrwl/react/src/utils/versions");
|
|
11
|
+
const versions_2 = require("../../utils/versions");
|
|
12
|
+
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
13
|
+
const init_root_babel_config_1 = require("./lib/init-root-babel-config");
|
|
13
14
|
function reactNativeInitGenerator(host, schema) {
|
|
14
15
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
15
16
|
(0, set_default_collection_1.setDefaultCollection)(host, '@nrwl/react-native');
|
|
16
17
|
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
|
|
18
|
+
(0, init_root_babel_config_1.initRootBabelConfig)(host);
|
|
17
19
|
const tasks = [moveDependency(host), updateDependencies(host)];
|
|
18
20
|
if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') {
|
|
19
21
|
const jestTask = (0, jest_1.jestInitGenerator)(host, {});
|
|
@@ -33,12 +35,12 @@ exports.reactNativeInitGenerator = reactNativeInitGenerator;
|
|
|
33
35
|
function updateDependencies(host) {
|
|
34
36
|
const isPnpm = (0, devkit_1.detectPackageManager)(host.root) === 'pnpm';
|
|
35
37
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
36
|
-
react:
|
|
37
|
-
'react-native':
|
|
38
|
-
}, Object.assign({ '@nrwl/react-native':
|
|
38
|
+
react: versions_1.reactVersion,
|
|
39
|
+
'react-native': versions_2.reactNativeVersion,
|
|
40
|
+
}, Object.assign({ '@nrwl/react-native': versions_2.nxVersion, '@types/react': versions_1.typesReactVersion, '@types/react-native': versions_2.typesReactNativeVersion, '@react-native-community/cli': versions_2.reactNativeCommunityCli, '@react-native-community/cli-platform-android': versions_2.reactNativeCommunityCliAndroid, '@react-native-community/cli-platform-ios': versions_2.reactNativeCommunityCliIos, 'metro-react-native-babel-preset': versions_2.metroReactNativeBabelPresetVersion, '@testing-library/react-native': versions_2.testingLibraryReactNativeVersion, '@testing-library/jest-native': versions_2.testingLibraryJestNativeVersion, 'jest-react-native': versions_2.jestReactNativeVersion, metro: versions_2.metroVersion, 'metro-resolver': versions_2.metroVersion, 'react-test-renderer': versions_2.reactTestRendererVersion, 'react-native-svg-transformer': versions_2.reactNativeSvgTransformerVersion, 'react-native-svg': versions_2.reactNativeSvgVersion, 'react-native-config': versions_2.reactNativeConfigVersion }, (isPnpm
|
|
39
41
|
? {
|
|
40
|
-
'metro-config':
|
|
41
|
-
'@babel/runtime':
|
|
42
|
+
'metro-config': versions_2.metroVersion,
|
|
43
|
+
'@babel/runtime': versions_2.babelRuntimeVersion, // @babel/runtime is used by react-native-svg
|
|
42
44
|
}
|
|
43
45
|
: {})));
|
|
44
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,iGAA4F;AAC5F,yCAOsB;AAEtB,
|
|
1
|
+
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,MAAM,CAAC;IAC1D,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ;QACE,KAAK,EAAE,uBAAY;QACnB,cAAc,EAAE,6BAAkB;KACnC,kBAEC,oBAAoB,EAAE,oBAAS,EAC/B,cAAc,EAAE,4BAAiB,EACjC,qBAAqB,EAAE,kCAAuB,EAC9C,6BAA6B,EAAE,kCAAuB,EACtD,8CAA8C,EAC5C,yCAA8B,EAChC,0CAA0C,EAAE,qCAA0B,EACtE,iCAAiC,EAAE,6CAAkC,EACrE,+BAA+B,EAAE,2CAAgC,EACjE,8BAA8B,EAAE,0CAA+B,EAC/D,mBAAmB,EAAE,iCAAsB,EAC3C,KAAK,EAAE,uBAAY,EACnB,gBAAgB,EAAE,uBAAY,EAC9B,qBAAqB,EAAE,mCAAwB,EAC/C,8BAA8B,EAAE,2CAAgC,EAChE,kBAAkB,EAAE,gCAAqB,EACzC,qBAAqB,EAAE,mCAAwB,IAC5C,CAAC,MAAM;QACR,CAAC,CAAC;YACE,cAAc,EAAE,uBAAY;YAC5B,gBAAgB,EAAE,8BAAmB,EAAE,6CAA6C;SACrF;QACH,CAAC,CAAC,EAAE,CAAC,EAEV,CAAC;AACJ,CAAC;AAlCD,gDAkCC;AAED,SAAS,cAAc,CAAC,IAAU;IAChC,OAAO,IAAA,0CAAiC,EAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,kBAAe,wBAAwB,CAAC;AAC3B,QAAA,wBAAwB,GAAG,IAAA,2BAAkB,EACxD,wBAAwB,CACzB,CAAC"}
|
|
@@ -56,4 +56,35 @@ describe('init', () => {
|
|
|
56
56
|
expect(cli.defaultCollection).toEqual('@nrwl/react');
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
+
|
|
60
|
+
describe('babel config', () => {
|
|
61
|
+
it('should create babel config if not present', async () => {
|
|
62
|
+
await reactNativeInitGenerator(tree, {
|
|
63
|
+
unitTestRunner: 'none',
|
|
64
|
+
e2eTestRunner: 'none',
|
|
65
|
+
});
|
|
66
|
+
expect(tree.exists('babel.config.json')).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should not overwrite existing babel config', async () => {
|
|
70
|
+
tree.write('babel.config.json', '{ "preset": ["preset-awesome"] }');
|
|
71
|
+
|
|
72
|
+
await reactNativeInitGenerator(tree, {
|
|
73
|
+
unitTestRunner: 'none',
|
|
74
|
+
e2eTestRunner: 'none',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const existing = readJson(tree, 'babel.config.json');
|
|
78
|
+
expect(existing).toEqual({ preset: ['preset-awesome'] });
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should not overwrite existing babel config (.js)', async () => {
|
|
82
|
+
tree.write('/babel.config.js', 'module.exports = () => {};');
|
|
83
|
+
await reactNativeInitGenerator(tree, {
|
|
84
|
+
unitTestRunner: 'none',
|
|
85
|
+
e2eTestRunner: 'none',
|
|
86
|
+
});
|
|
87
|
+
expect(tree.exists('babel.config.json')).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
59
90
|
});
|
|
@@ -5,14 +5,13 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
5
5
|
const ignore_1 = require("ignore");
|
|
6
6
|
const gitignore_entries_1 = require("./gitignore-entries");
|
|
7
7
|
function addGitIgnoreEntry(host) {
|
|
8
|
-
var _a;
|
|
9
8
|
if (!host.exists('.gitignore')) {
|
|
10
9
|
devkit_1.logger.warn(`Couldn't find .gitignore file to update`);
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
|
-
let content =
|
|
12
|
+
let content = host.read('.gitignore', 'utf-8').trimEnd();
|
|
14
13
|
const ig = (0, ignore_1.default)();
|
|
15
|
-
ig.add(host.read('.gitignore')
|
|
14
|
+
ig.add(host.read('.gitignore', 'utf-8'));
|
|
16
15
|
if (!ig.ignores('apps/example/ios/Pods/Folly')) {
|
|
17
16
|
content = `${content}\n${gitignore_entries_1.gitIgnoreEntriesForReactNative}/\n`;
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/react-native/src/generators/init/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAC5C,mCAA4B;AAC5B,2DAAqE;AAErE,SAAgB,iBAAiB,CAAC,IAAU
|
|
1
|
+
{"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/react-native/src/generators/init/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAC5C,mCAA4B;AAC5B,2DAAqE;AAErE,SAAgB,iBAAiB,CAAC,IAAU;IAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC9B,eAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO;KACR;IAED,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;IAEzD,MAAM,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAC;IACpB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,EAAE;QAC9C,OAAO,GAAG,GAAG,OAAO,KAAK,kDAA8B,KAAK,CAAC;KAC9D;IAED,0EAA0E;IAC1E,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,2BAA2B,CAAC,EAAE;QAC5C,OAAO,GAAG,GAAG,OAAO,6CAA6C,CAAC;KACnE;IAED,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AArBD,8CAqBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initRootBabelConfig = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function initRootBabelConfig(tree) {
|
|
6
|
+
if (tree.exists('/babel.config.json') || tree.exists('/babel.config.js')) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
(0, devkit_1.writeJson)(tree, '/babel.config.json', {
|
|
10
|
+
babelrcRoots: ['*'], // Make sure .babelrc files other than root can be loaded in a monorepo
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.initRootBabelConfig = initRootBabelConfig;
|
|
14
|
+
//# sourceMappingURL=init-root-babel-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-root-babel-config.js","sourceRoot":"","sources":["../../../../../../../packages/react-native/src/generators/init/lib/init-root-babel-config.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAE/C,SAAgB,mBAAmB,CAAC,IAAU;IAC5C,IAAI,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE;QACxE,OAAO;KACR;IAED,IAAA,kBAAS,EAAC,IAAI,EAAE,oBAAoB,EAAE;QACpC,YAAY,EAAE,CAAC,GAAG,CAAC,EAAE,uEAAuE;KAC7F,CAAC,CAAC;AACL,CAAC;AARD,kDAQC"}
|
|
@@ -40,7 +40,7 @@ function addReactNativeSvgToTsconfig(host, project) {
|
|
|
40
40
|
const offset = (0, devkit_1.offsetFromRoot)(project.root);
|
|
41
41
|
(0, devkit_1.updateJson)(host, tsconfigPath, (json) => {
|
|
42
42
|
const files = json.files || [];
|
|
43
|
-
files.push(`${offset}node_modules/@nrwl/react/typings/
|
|
43
|
+
files.push(`${offset}node_modules/@nrwl/react-native/typings/svg.d.ts`);
|
|
44
44
|
json.files = files;
|
|
45
45
|
return json;
|
|
46
46
|
});
|
|
@@ -1 +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,IAAA,oBAAW,EAAC,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,IAAA,oBAAW,EAAC,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,IAAA,mBAAU,EAAC,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,IAAA,uBAAc,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAA,mBAAU,EAAC,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,
|
|
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,IAAA,oBAAW,EAAC,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,IAAA,oBAAW,EAAC,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,IAAA,mBAAU,EAAC,IAAI,EAAE,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;QACzC,MAAM,YAAY,GAAG,IA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BAAY,EAAA,oBAAoB,cAAc,gBAAgB,OAAO,CAAC,IAAI,GAAG,CAC9E,CAAC;KACH;AACH,CAAC"}
|
|
@@ -50,7 +50,7 @@ describe('Add react-native-svg to dev dependencies', () => {
|
|
|
50
50
|
|
|
51
51
|
const tsconfig = readJson(tree, 'apps/products/tsconfig.json');
|
|
52
52
|
expect(tsconfig.files).toEqual([
|
|
53
|
-
'../../node_modules/@nrwl/react/typings/
|
|
53
|
+
'../../node_modules/@nrwl/react-native/typings/svg.d.ts',
|
|
54
54
|
]);
|
|
55
55
|
|
|
56
56
|
const packageJson = readJson(tree, 'apps/products/package.json');
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const init_root_babel_config_1 = require("../../generators/init/lib/init-root-babel-config");
|
|
6
|
+
function update(tree) {
|
|
7
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
if (tree.exists('/babel.config.json') || tree.exists('/babel.config.js')) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let hasReactNaiveProject = false;
|
|
13
|
+
projects.forEach((project) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (hasReactNaiveProject)
|
|
16
|
+
return;
|
|
17
|
+
hasReactNaiveProject =
|
|
18
|
+
((_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/react-native:start';
|
|
19
|
+
});
|
|
20
|
+
if (hasReactNaiveProject) {
|
|
21
|
+
(0, init_root_babel_config_1.initRootBabelConfig)(tree);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.default = update;
|
|
26
|
+
//# sourceMappingURL=add-babel-config-root-13-5-0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-babel-config-root-13-5-0.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAEjD,6FAAuF;AAEvF,SAA8B,MAAM,CAAC,IAAU;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,IAAI,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE;YACxE,OAAO;SACR;QAED,IAAI,oBAAoB,GAAG,KAAK,CAAC;QACjC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;;YAC3B,IAAI,oBAAoB;gBAAE,OAAO;YACjC,oBAAoB;gBAClB,CAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,0CAAE,QAAQ,MAAK,0BAA0B,CAAC;QACpE,CAAC,CAAC,CAAC;QAEH,IAAI,oBAAoB,EAAE;YACxB,IAAA,4CAAmB,EAAC,IAAI,CAAC,CAAC;SAC3B;IACH,CAAC;CAAA;AAjBD,yBAiBC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
|
|
2
|
+
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
|
3
|
+
import update from './add-babel-config-root-13-5-0';
|
|
4
|
+
|
|
5
|
+
describe('Add react-native-svg to dev dependencies', () => {
|
|
6
|
+
let tree: Tree;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
tree = createTreeWithEmptyWorkspace();
|
|
10
|
+
addProjectConfiguration(tree, 'products', {
|
|
11
|
+
root: 'apps/products',
|
|
12
|
+
sourceRoot: 'apps/products/src',
|
|
13
|
+
targets: {
|
|
14
|
+
start: {
|
|
15
|
+
executor: '@nrwl/react-native:start',
|
|
16
|
+
options: {
|
|
17
|
+
port: 8081,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
test: {
|
|
21
|
+
executor: '@nrwl/jest:jest',
|
|
22
|
+
options: {
|
|
23
|
+
jestConfig: 'apps/products/jest.config.js',
|
|
24
|
+
passWithNoTests: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it(`should add babel.config.json at root`, async () => {
|
|
32
|
+
await update(tree);
|
|
33
|
+
|
|
34
|
+
const babelConfigJson = readJson(tree, 'babel.config.json');
|
|
35
|
+
expect(babelConfigJson).toEqual({
|
|
36
|
+
babelrcRoots: ['*'],
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it(`should not change babel.config.json if it already exists`, async () => {
|
|
41
|
+
tree.write('babel.config.json', '{}');
|
|
42
|
+
|
|
43
|
+
await update(tree);
|
|
44
|
+
|
|
45
|
+
const babelConfigJson = readJson(tree, 'babel.config.json');
|
|
46
|
+
expect(babelConfigJson).toEqual({});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Tree } from '@nrwl/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Update svg typings in tsconfig for react native app
|
|
4
|
+
* Replace node_modules/@nrwl/react/typings/image.d.ts with node_modules/@nrwl/react-native/typings/svg.d.ts
|
|
5
|
+
*/
|
|
6
|
+
export default function update(tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* Update svg typings in tsconfig for react native app
|
|
7
|
+
* Replace node_modules/@nrwl/react/typings/image.d.ts with node_modules/@nrwl/react-native/typings/svg.d.ts
|
|
8
|
+
*/
|
|
9
|
+
function update(tree) {
|
|
10
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
11
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
+
projects.forEach((project) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
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')
|
|
15
|
+
return;
|
|
16
|
+
updateReactNativeSvgTypingInTsconfig(tree, project);
|
|
17
|
+
});
|
|
18
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.default = update;
|
|
22
|
+
function updateReactNativeSvgTypingInTsconfig(host, project) {
|
|
23
|
+
const tsconfigPath = `${project.root}/tsconfig.json`;
|
|
24
|
+
if (!host.exists(tsconfigPath))
|
|
25
|
+
return;
|
|
26
|
+
const offset = (0, devkit_1.offsetFromRoot)(project.root);
|
|
27
|
+
(0, devkit_1.updateJson)(host, tsconfigPath, (json) => {
|
|
28
|
+
const files = json.files || [];
|
|
29
|
+
const imageTypingIndex = files.findIndex((file) => file === `${offset}node_modules/@nrwl/react/typings/image.d.ts`);
|
|
30
|
+
const reactNativeSvgTypingPath = `${offset}node_modules/@nrwl/react-native/typings/svg.d.ts`;
|
|
31
|
+
if (imageTypingIndex === -1) {
|
|
32
|
+
files.push(reactNativeSvgTypingPath);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
files[imageTypingIndex] = reactNativeSvgTypingPath;
|
|
36
|
+
}
|
|
37
|
+
json.files = files;
|
|
38
|
+
return json;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=update-react-native-typing-svg-13-5-0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-react-native-typing-svg-13-5-0.js","sourceRoot":"","s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AAwB,CAAC;SACpD;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
|
|
2
|
+
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
|
3
|
+
import update from './update-react-native-typing-svg-13-5-0';
|
|
4
|
+
|
|
5
|
+
describe('Update svg typings in tsconfig for react native app', () => {
|
|
6
|
+
let tree: Tree;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
tree = createTreeWithEmptyWorkspace();
|
|
10
|
+
addProjectConfiguration(tree, 'products', {
|
|
11
|
+
root: 'apps/products',
|
|
12
|
+
sourceRoot: 'apps/products/src',
|
|
13
|
+
targets: {
|
|
14
|
+
start: {
|
|
15
|
+
executor: '@nrwl/react-native:start',
|
|
16
|
+
options: {
|
|
17
|
+
port: 8081,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
test: {
|
|
21
|
+
executor: '@nrwl/jest:jest',
|
|
22
|
+
options: {
|
|
23
|
+
jestConfig: 'apps/products/jest.config.js',
|
|
24
|
+
passWithNoTests: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it(`should add svg typing to tsconfig.json`, async () => {
|
|
32
|
+
tree.write('apps/products/tsconfig.json', '{}');
|
|
33
|
+
await update(tree);
|
|
34
|
+
|
|
35
|
+
const tsconfig = readJson(tree, 'apps/products/tsconfig.json');
|
|
36
|
+
expect(tsconfig.files).toEqual([
|
|
37
|
+
'../../node_modules/@nrwl/react-native/typings/svg.d.ts',
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it(`should update to svg typing in tsconfig.json if image typing from react exists`, async () => {
|
|
42
|
+
tree.write(
|
|
43
|
+
'apps/products/tsconfig.json',
|
|
44
|
+
`{
|
|
45
|
+
"files": ["../../node_modules/@nrwl/react/typings/image.d.ts"]
|
|
46
|
+
}`
|
|
47
|
+
);
|
|
48
|
+
await update(tree);
|
|
49
|
+
|
|
50
|
+
const tsconfig = readJson(tree, 'apps/products/tsconfig.json');
|
|
51
|
+
expect(tsconfig.files).toEqual([
|
|
52
|
+
'../../node_modules/@nrwl/react-native/typings/svg.d.ts',
|
|
53
|
+
]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it(`should update app's tsconfig.json and package.json if file does not exist`, async () => {
|
|
57
|
+
await update(tree);
|
|
58
|
+
|
|
59
|
+
expect(() => readJson(tree, 'apps/products/tsconfig.json')).toThrow();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findAllNpmDependencies } from './find-all-npm-dependencies';
|
|
2
|
-
import { ProjectGraph } from '@nrwl/devkit';
|
|
2
|
+
import { DependencyType, ProjectGraph } from '@nrwl/devkit';
|
|
3
3
|
|
|
4
4
|
test('findAllNpmDependencies', () => {
|
|
5
5
|
const graph: ProjectGraph = {
|
|
@@ -61,26 +61,34 @@ test('findAllNpmDependencies', () => {
|
|
|
61
61
|
},
|
|
62
62
|
dependencies: {
|
|
63
63
|
myapp: [
|
|
64
|
-
{ type:
|
|
65
|
-
{ type:
|
|
64
|
+
{ type: DependencyType.static, source: 'myapp', target: 'lib1' },
|
|
65
|
+
{ type: DependencyType.static, source: 'myapp', target: 'lib2' },
|
|
66
66
|
{
|
|
67
|
-
type:
|
|
67
|
+
type: DependencyType.static,
|
|
68
68
|
source: 'myapp',
|
|
69
69
|
target: 'npm:react-native-image-picker',
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
type:
|
|
72
|
+
type: DependencyType.static,
|
|
73
73
|
source: 'myapp',
|
|
74
74
|
target: 'npm:@nrwl/react-native',
|
|
75
75
|
},
|
|
76
76
|
],
|
|
77
77
|
lib1: [
|
|
78
|
-
{ type:
|
|
79
|
-
{
|
|
78
|
+
{ type: DependencyType.static, source: 'lib1', target: 'lib2' },
|
|
79
|
+
{
|
|
80
|
+
type: DependencyType.static,
|
|
81
|
+
source: 'lib3',
|
|
82
|
+
target: 'npm:react-native-snackbar',
|
|
83
|
+
},
|
|
80
84
|
],
|
|
81
|
-
lib2: [{ type:
|
|
85
|
+
lib2: [{ type: DependencyType.static, source: 'lib2', target: 'lib3' }],
|
|
82
86
|
lib3: [
|
|
83
|
-
{
|
|
87
|
+
{
|
|
88
|
+
type: DependencyType.static,
|
|
89
|
+
source: 'lib3',
|
|
90
|
+
target: 'npm:react-native-dialog',
|
|
91
|
+
},
|
|
84
92
|
],
|
|
85
93
|
},
|
|
86
94
|
};
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
export declare const nxVersion = "*";
|
|
2
|
-
export declare const reactNativeVersion = "0.66.
|
|
3
|
-
export declare const typesReactNativeVersion = "0.66.
|
|
2
|
+
export declare const reactNativeVersion = "0.66.4";
|
|
3
|
+
export declare const typesReactNativeVersion = "0.66.11";
|
|
4
4
|
export declare const metroVersion = "0.66.2";
|
|
5
|
-
export declare const reactNativeCommunityCli = "6.1
|
|
6
|
-
export declare const reactNativeCommunityCliIos = "6.
|
|
7
|
-
export declare const reactNativeCommunityCliAndroid = "6.
|
|
5
|
+
export declare const reactNativeCommunityCli = "6.3.1";
|
|
6
|
+
export declare const reactNativeCommunityCliIos = "6.2.0";
|
|
7
|
+
export declare const reactNativeCommunityCliAndroid = "6.3.0";
|
|
8
|
+
export declare const reactNativeConfigVersion = "1.4.5";
|
|
8
9
|
export declare const metroReactNativeBabelPresetVersion = "0.66.2";
|
|
9
|
-
export declare const testingLibraryReactNativeVersion = "
|
|
10
|
+
export declare const testingLibraryReactNativeVersion = "9.0.0";
|
|
10
11
|
export declare const testingLibraryJestNativeVersion = "4.0.4";
|
|
11
12
|
export declare const jestReactNativeVersion = "18.0.0";
|
|
12
13
|
export declare const reactTestRendererVersion = "17.0.2";
|
|
13
|
-
export declare const reactNativeSvgTransformerVersion = "0.
|
|
14
|
+
export declare const reactNativeSvgTransformerVersion = "1.0.0";
|
|
14
15
|
export declare const reactNativeSvgVersion = "12.1.1";
|
|
15
|
-
export declare const babelRuntimeVersion = "7.16.
|
|
16
|
+
export declare const babelRuntimeVersion = "7.16.7";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.babelRuntimeVersion = 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.nxVersion = void 0;
|
|
4
|
-
exports.nxVersion = '13.
|
|
5
|
-
exports.reactNativeVersion = '0.66.
|
|
6
|
-
exports.typesReactNativeVersion = '0.66.
|
|
3
|
+
exports.babelRuntimeVersion = exports.reactNativeSvgVersion = exports.reactNativeSvgTransformerVersion = exports.reactTestRendererVersion = exports.jestReactNativeVersion = exports.testingLibraryJestNativeVersion = exports.testingLibraryReactNativeVersion = exports.metroReactNativeBabelPresetVersion = exports.reactNativeConfigVersion = exports.reactNativeCommunityCliAndroid = exports.reactNativeCommunityCliIos = exports.reactNativeCommunityCli = exports.metroVersion = exports.typesReactNativeVersion = exports.reactNativeVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.nxVersion = '13.5.0-beta.2';
|
|
5
|
+
exports.reactNativeVersion = '0.66.4';
|
|
6
|
+
exports.typesReactNativeVersion = '0.66.11';
|
|
7
7
|
exports.metroVersion = '0.66.2';
|
|
8
|
-
exports.reactNativeCommunityCli = '6.1
|
|
9
|
-
exports.reactNativeCommunityCliIos = '6.
|
|
10
|
-
exports.reactNativeCommunityCliAndroid = '6.
|
|
8
|
+
exports.reactNativeCommunityCli = '6.3.1';
|
|
9
|
+
exports.reactNativeCommunityCliIos = '6.2.0';
|
|
10
|
+
exports.reactNativeCommunityCliAndroid = '6.3.0';
|
|
11
|
+
exports.reactNativeConfigVersion = '1.4.5';
|
|
11
12
|
exports.metroReactNativeBabelPresetVersion = '0.66.2';
|
|
12
|
-
exports.testingLibraryReactNativeVersion = '
|
|
13
|
+
exports.testingLibraryReactNativeVersion = '9.0.0';
|
|
13
14
|
exports.testingLibraryJestNativeVersion = '4.0.4';
|
|
14
15
|
exports.jestReactNativeVersion = '18.0.0';
|
|
15
16
|
exports.reactTestRendererVersion = '17.0.2';
|
|
16
|
-
exports.reactNativeSvgTransformerVersion = '0.
|
|
17
|
+
exports.reactNativeSvgTransformerVersion = '1.0.0';
|
|
17
18
|
exports.reactNativeSvgVersion = '12.1.1';
|
|
18
|
-
exports.babelRuntimeVersion = '7.16.
|
|
19
|
+
exports.babelRuntimeVersion = '7.16.7';
|
|
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,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,kBAAkB,GAAG,QAAQ,CAAC;AAC9B,QAAA,uBAAuB,GAAG,SAAS,CAAC;AAEpC,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,wBAAwB,GAAG,OAAO,CAAC;AAEnC,QAAA,kCAAkC,GAAG,QAAQ,CAAC;AAE9C,QAAA,gCAAgC,GAAG,OAAO,CAAC;AAC3C,QAAA,+BAA+B,GAAG,OAAO,CAAC;AAE1C,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAElC,QAAA,wBAAwB,GAAG,QAAQ,CAAC;AAEpC,QAAA,gCAAgC,GAAG,OAAO,CAAC;AAC3C,QAAA,qBAAqB,GAAG,QAAQ,CAAC;AAEjC,QAAA,mBAAmB,GAAG,QAAQ,CAAC"}
|
package/typings/svg.d.ts
ADDED