@nx/expo 18.0.0-beta.0 → 18.0.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/.eslintrc.json +3 -0
- package/docs/export-examples.md +112 -0
- package/docs/start-examples.md +6 -0
- package/executors.json +5 -0
- package/generators.json +2 -2
- package/migrations.json +85 -6
- package/package.json +12 -16
- package/plugins/metro-resolver.js +4 -1
- package/plugins/plugin.js +10 -7
- package/plugins/with-nx-metro.js +6 -2
- package/plugins/with-nx-webpack.d.ts +1 -1
- package/plugins/with-nx-webpack.js +8 -4
- package/src/executors/build/build.impl.js +2 -1
- package/src/executors/build/schema.json +1 -1
- package/src/executors/build-list/build-list.impl.js +2 -3
- package/src/executors/build-list/schema.json +1 -1
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +4 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +4 -0
- package/src/executors/ensure-symlink/schema.json +1 -1
- package/src/executors/export/export.impl.d.ts +1 -0
- package/src/executors/export/export.impl.js +25 -15
- package/src/executors/export/schema.d.ts +4 -2
- package/src/executors/export/schema.json +14 -13
- package/src/executors/install/install.impl.js +0 -2
- package/src/executors/install/schema.json +1 -1
- package/src/executors/prebuild/prebuild.impl.js +11 -5
- package/src/executors/prebuild/schema.json +2 -1
- package/src/executors/run/schema.json +1 -1
- package/src/executors/serve/lib/is-packager-running.d.ts +1 -0
- package/src/executors/serve/lib/is-packager-running.js +15 -0
- package/src/executors/serve/schema.d.ts +7 -0
- package/src/executors/serve/schema.json +35 -0
- package/src/executors/serve/serve.impl.d.ts +11 -0
- package/src/executors/serve/serve.impl.js +103 -0
- package/src/executors/start/schema.json +1 -1
- package/src/executors/start/start.impl.js +7 -1
- package/src/executors/submit/schema.json +1 -1
- package/src/executors/submit/submit.impl.js +2 -1
- package/src/executors/sync-deps/schema.json +1 -1
- package/src/executors/sync-deps/sync-deps.impl.d.ts +4 -4
- package/src/executors/sync-deps/sync-deps.impl.js +20 -5
- package/src/executors/update/schema.json +1 -1
- package/src/executors/update/update.impl.js +3 -4
- package/src/generators/application/application.js +9 -7
- package/src/generators/application/files/app.json.template +2 -0
- package/src/generators/application/files/eas.json.template +0 -3
- package/src/generators/application/files/metro.config.js.template +0 -4
- package/src/generators/application/files/src/app/App.tsx.template +29 -2
- package/src/generators/application/files/webpack.config.js.template +57 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +85 -0
- package/src/generators/application/lib/add-project.js +12 -21
- package/src/generators/application/lib/create-application-files.js +0 -2
- package/src/generators/application/lib/normalize-options.d.ts +3 -0
- package/src/generators/application/lib/normalize-options.js +8 -1
- package/src/generators/application/schema.d.ts +2 -1
- package/src/generators/application/schema.json +4 -4
- package/src/generators/component/schema.d.ts +3 -3
- package/src/generators/component/schema.json +4 -4
- package/src/generators/init/init.d.ts +2 -1
- package/src/generators/init/init.js +9 -5
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +1 -1
- package/src/generators/library/files/lib/.babelrc.js.template +21 -0
- package/src/generators/library/lib/normalize-options.js +1 -0
- package/src/generators/library/library.js +6 -1
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +2 -2
- package/src/migrations/update-16-6-0/update-metro-config.js +0 -4
- package/src/migrations/update-16-9-0/remove-types-react-native.js +2 -9
- package/src/migrations/update-16-9-0/update-eas-cli-version.js +1 -2
- package/src/migrations/{update-16-1-4/add-detox-app-json.d.ts → update-18-0-0/change-outputDir-export-target.d.ts} +1 -1
- package/src/migrations/update-18-0-0/change-outputDir-export-target.js +25 -0
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-block-list.js +26 -0
- package/src/migrations/update-18-0-0/remove-eas-cli.d.ts +12 -0
- package/src/migrations/update-18-0-0/remove-eas-cli.js +18 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.js +29 -0
- package/src/utils/add-jest.d.ts +1 -1
- package/src/utils/add-jest.js +15 -5
- package/src/utils/add-linting.d.ts +1 -0
- package/src/utils/add-linting.js +1 -0
- package/src/utils/ensure-dependencies.js +1 -2
- package/src/utils/resolve-eas.d.ts +1 -0
- package/src/utils/resolve-eas.js +36 -0
- package/src/utils/versions.d.ts +13 -14
- package/src/utils/versions.js +14 -15
- package/src/generators/application/lib/add-detox.d.ts +0 -3
- package/src/generators/application/lib/add-detox.js +0 -24
- package/src/generators/library/files/lib/babel.config.json +0 -17
- package/src/migrations/update-16-1-4/add-detox-app-json.js +0 -29
- package/src/utils/find-all-npm-dependencies.d.ts +0 -2
- package/src/utils/find-all-npm-dependencies.js +0 -25
- package/src/utils/symlink-task.d.ts +0 -2
- package/src/utils/symlink-task.js +0 -18
- /package/src/generators/application/files/{babel.config.js.template → .babelrc.js.template} +0 -0
package/.eslintrc.json
CHANGED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
`project.json`:
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"name": "mobile",
|
|
6
|
+
//...
|
|
7
|
+
"targets": {
|
|
8
|
+
//...
|
|
9
|
+
"export": {
|
|
10
|
+
"executor": "@nx/expo:export",
|
|
11
|
+
"options": {
|
|
12
|
+
"outputs": ["{options.outputDir}"],
|
|
13
|
+
"platform": "all",
|
|
14
|
+
"outputDir": "dist/apps/mobile"
|
|
15
|
+
},
|
|
16
|
+
"dependsOn": ["sync-deps"]
|
|
17
|
+
}
|
|
18
|
+
//...
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
nx run mobile:export
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
{% tabs %}
|
|
30
|
+
{% tab label="Specify outputDir" %}
|
|
31
|
+
The `outputDir` option allows you to specify the output directory of your bundle:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
"export": {
|
|
35
|
+
"executor": "@nx/expo:export",
|
|
36
|
+
"outputs": ["{options.outputDir}"],
|
|
37
|
+
"options": {
|
|
38
|
+
"platform": "all",
|
|
39
|
+
"bundler": "metro",
|
|
40
|
+
"outputDir": "dist/apps/mobile"
|
|
41
|
+
},
|
|
42
|
+
"dependsOn": ["sync-deps"]
|
|
43
|
+
},
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
or run command: `nx run mobile:export --outputDir=dist/apps/mobile`.
|
|
47
|
+
|
|
48
|
+
{% /tab %}
|
|
49
|
+
{% tab label="Specify the platform" %}
|
|
50
|
+
The `platform` option allows you to specify the platform to compile with metro bundler: "ios", "android", "all", and "web".
|
|
51
|
+
|
|
52
|
+
For example, to bundle for web:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
"export": {
|
|
56
|
+
"executor": "@nx/expo:export",
|
|
57
|
+
"outputs": ["{options.outputDir}"],
|
|
58
|
+
"options": {
|
|
59
|
+
"platform": "web",
|
|
60
|
+
"bundler": "metro",
|
|
61
|
+
"outputDir": "dist/apps/dogs"
|
|
62
|
+
},
|
|
63
|
+
"dependsOn": ["sync-deps"]
|
|
64
|
+
},
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
or run command `nx export mobile --platform=web`.
|
|
68
|
+
|
|
69
|
+
{% /tab %}
|
|
70
|
+
{% tab label="Bundle for development" %}
|
|
71
|
+
|
|
72
|
+
The `dev` option allows you to bundle for development environments.
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
"export": {
|
|
76
|
+
"executor": "@nx/expo:export",
|
|
77
|
+
"outputs": ["{options.outputDir}"],
|
|
78
|
+
"options": {
|
|
79
|
+
"platform": "web",
|
|
80
|
+
"bundler": "metro",
|
|
81
|
+
"outputDir": "dist/apps/dogs",
|
|
82
|
+
"dev": true
|
|
83
|
+
},
|
|
84
|
+
"dependsOn": ["sync-deps"]
|
|
85
|
+
},
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
or run command `nx export mobile --dev`.
|
|
89
|
+
|
|
90
|
+
{% /tab %}
|
|
91
|
+
{% tab label="Clear bundle cache" %}
|
|
92
|
+
|
|
93
|
+
The `clear` option allows you to clear bundle cache.
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
"export": {
|
|
97
|
+
"executor": "@nx/expo:export",
|
|
98
|
+
"outputs": ["{options.outputDir}"],
|
|
99
|
+
"options": {
|
|
100
|
+
"platform": "web",
|
|
101
|
+
"bundler": "metro",
|
|
102
|
+
"outputDir": "dist/apps/dogs",
|
|
103
|
+
"clear": true
|
|
104
|
+
},
|
|
105
|
+
"dependsOn": ["sync-deps"]
|
|
106
|
+
},
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
or run command `nx export mobile --clear`.
|
|
110
|
+
|
|
111
|
+
{% /tab %}
|
|
112
|
+
{% /tabs %}
|
package/docs/start-examples.md
CHANGED
|
@@ -39,6 +39,8 @@ Opens your app in Expo Go in a currently running iOS simulator on your computer:
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
or run command `nx start <your app name> --ios`.
|
|
43
|
+
|
|
42
44
|
Opens your app in Expo Go on a connected Android device
|
|
43
45
|
|
|
44
46
|
```json
|
|
@@ -51,6 +53,8 @@ Opens your app in Expo Go on a connected Android device
|
|
|
51
53
|
}
|
|
52
54
|
```
|
|
53
55
|
|
|
56
|
+
or run command `nx start <your app name> --android`.
|
|
57
|
+
|
|
54
58
|
Opens your app in a web browser:
|
|
55
59
|
|
|
56
60
|
```json
|
|
@@ -63,6 +67,8 @@ Opens your app in a web browser:
|
|
|
63
67
|
}
|
|
64
68
|
```
|
|
65
69
|
|
|
70
|
+
or run command `nx start <your app name> --web`.
|
|
71
|
+
|
|
66
72
|
{% /tab %}
|
|
67
73
|
{% tab label="Specify the host" %}
|
|
68
74
|
The `host` option allows you to specify the type of host to use. `lan` uses the local network; `tunnel` ues any network by tunnel through ngrok; `localhost` connects to the dev server over localhost.
|
package/executors.json
CHANGED
|
@@ -54,6 +54,11 @@
|
|
|
54
54
|
"implementation": "./src/executors/submit/submit.impl",
|
|
55
55
|
"schema": "./src/executors/submit/schema.json",
|
|
56
56
|
"description": "Submit app binary to App Store and/or Play Store"
|
|
57
|
+
},
|
|
58
|
+
"serve": {
|
|
59
|
+
"implementation": "./src/executors/serve/serve.impl",
|
|
60
|
+
"schema": "./src/executors/serve/schema.json",
|
|
61
|
+
"description": "Serve up the Expo web app locally"
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
}
|
package/generators.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"extends": ["@nx/workspace"],
|
|
5
5
|
"generators": {
|
|
6
6
|
"init": {
|
|
7
|
-
"factory": "./src/generators/init/init#
|
|
7
|
+
"factory": "./src/generators/init/init#expoInitGeneratorInternal",
|
|
8
8
|
"schema": "./src/generators/init/schema.json",
|
|
9
|
-
"description": "Initialize the @
|
|
9
|
+
"description": "Initialize the @nx/expo plugin",
|
|
10
10
|
"hidden": true
|
|
11
11
|
},
|
|
12
12
|
"application": {
|
package/migrations.json
CHANGED
|
@@ -36,12 +36,6 @@
|
|
|
36
36
|
"description": "Update package.json eas build lifecycle scripts",
|
|
37
37
|
"implementation": "./src/migrations/update-16-1-4/update-eas-scripts"
|
|
38
38
|
},
|
|
39
|
-
"add-detox-app-json-16-1-4": {
|
|
40
|
-
"version": "16.1.4-beta.0",
|
|
41
|
-
"cli": "nx",
|
|
42
|
-
"description": "Add app.json for detox",
|
|
43
|
-
"factory": "./src/migrations/update-16-1-4/add-detox-app-json"
|
|
44
|
-
},
|
|
45
39
|
"update-16-6-0-add-dependsOn": {
|
|
46
40
|
"cli": "nx",
|
|
47
41
|
"version": "16.6.0-beta.0",
|
|
@@ -65,6 +59,30 @@
|
|
|
65
59
|
"version": "16.9.0-beta.1",
|
|
66
60
|
"description": "Update eas.json cli version",
|
|
67
61
|
"implementation": "./src/migrations/update-16-9-0/update-eas-cli-version"
|
|
62
|
+
},
|
|
63
|
+
"update-18-0-0-remove-block-list": {
|
|
64
|
+
"cli": "nx",
|
|
65
|
+
"version": "18.0.0-beta.0",
|
|
66
|
+
"description": "Remove blockList in metro.config.js",
|
|
67
|
+
"implementation": "./src/migrations/update-18-0-0/remove-block-list"
|
|
68
|
+
},
|
|
69
|
+
"update-18-0-0-remove-symlink-target": {
|
|
70
|
+
"cli": "nx",
|
|
71
|
+
"version": "18.0.0-beta.0",
|
|
72
|
+
"description": "Remove symlink target in project.json",
|
|
73
|
+
"implementation": "./src/migrations/update-18-0-0/remove-symlink-target"
|
|
74
|
+
},
|
|
75
|
+
"update-18-0-0-remove-eas-cli": {
|
|
76
|
+
"cli": "nx",
|
|
77
|
+
"version": "18.0.0-beta.0",
|
|
78
|
+
"description": "Remove eas-cli from package.json",
|
|
79
|
+
"implementation": "./src/migrations/update-18-0-0/remove-eas-cli"
|
|
80
|
+
},
|
|
81
|
+
"update-18-0-0-remove-offset-export-outputDir": {
|
|
82
|
+
"cli": "nx",
|
|
83
|
+
"version": "18.0.0-beta.0",
|
|
84
|
+
"description": "Remove the offset from the outputDir of the export target",
|
|
85
|
+
"implementation": "./src/migrations/update-18-0-0/change-outputDir-export-target"
|
|
68
86
|
}
|
|
69
87
|
},
|
|
70
88
|
"packageJsonUpdates": {
|
|
@@ -605,6 +623,67 @@
|
|
|
605
623
|
"alwaysAddToPackageJson": false
|
|
606
624
|
}
|
|
607
625
|
}
|
|
626
|
+
},
|
|
627
|
+
"18.0.0": {
|
|
628
|
+
"version": "18.0.0-beta.0",
|
|
629
|
+
"packages": {
|
|
630
|
+
"expo": {
|
|
631
|
+
"version": "50.0.1",
|
|
632
|
+
"alwaysAddToPackageJson": false
|
|
633
|
+
},
|
|
634
|
+
"expo-splash-screen": {
|
|
635
|
+
"version": "~0.26.1",
|
|
636
|
+
"alwaysAddToPackageJson": false
|
|
637
|
+
},
|
|
638
|
+
"expo-status-bar": {
|
|
639
|
+
"version": "~1.11.1",
|
|
640
|
+
"alwaysAddToPackageJson": false
|
|
641
|
+
},
|
|
642
|
+
"@expo/cli": {
|
|
643
|
+
"version": "~0.16.5",
|
|
644
|
+
"alwaysAddToPackageJson": false
|
|
645
|
+
},
|
|
646
|
+
"babel-preset-expo": {
|
|
647
|
+
"version": "~10.0.0",
|
|
648
|
+
"alwaysAddToPackageJson": false
|
|
649
|
+
},
|
|
650
|
+
"@types/react": {
|
|
651
|
+
"version": "~18.2.45",
|
|
652
|
+
"alwaysAddToPackageJson": false
|
|
653
|
+
},
|
|
654
|
+
"react-native": {
|
|
655
|
+
"version": "~0.73.2",
|
|
656
|
+
"alwaysAddToPackageJson": false
|
|
657
|
+
},
|
|
658
|
+
"react-native-web": {
|
|
659
|
+
"version": "~0.19.9",
|
|
660
|
+
"alwaysAddToPackageJson": false
|
|
661
|
+
},
|
|
662
|
+
"@expo/metro-config": {
|
|
663
|
+
"version": "~0.17.3",
|
|
664
|
+
"alwaysAddToPackageJson": false
|
|
665
|
+
},
|
|
666
|
+
"@expo/metro-runtime": {
|
|
667
|
+
"version": "~3.1.1",
|
|
668
|
+
"addToPackageJson": "devDependencies"
|
|
669
|
+
},
|
|
670
|
+
"react-native-svg-transformer": {
|
|
671
|
+
"version": "1.2.0",
|
|
672
|
+
"alwaysAddToPackageJson": false
|
|
673
|
+
},
|
|
674
|
+
"react-native-svg": {
|
|
675
|
+
"version": "14.1.0",
|
|
676
|
+
"alwaysAddToPackageJson": false
|
|
677
|
+
},
|
|
678
|
+
"@testing-library/react-native": {
|
|
679
|
+
"version": "~12.4.2",
|
|
680
|
+
"alwaysAddToPackageJson": false
|
|
681
|
+
},
|
|
682
|
+
"jest-expo": {
|
|
683
|
+
"version": "~50.0.1",
|
|
684
|
+
"alwaysAddToPackageJson": false
|
|
685
|
+
}
|
|
686
|
+
}
|
|
608
687
|
}
|
|
609
688
|
}
|
|
610
689
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "18.0.0-beta.
|
|
3
|
+
"version": "18.0.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,27 +26,23 @@
|
|
|
26
26
|
"main": "./index.js",
|
|
27
27
|
"types": "index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@nx/devkit": "18.0.0-beta.2",
|
|
29
30
|
"chalk": "^4.1.0",
|
|
30
31
|
"enhanced-resolve": "^5.8.3",
|
|
31
32
|
"fs-extra": "^11.1.0",
|
|
32
|
-
"metro-config": "~0.
|
|
33
|
-
"metro-resolver": "~0.
|
|
33
|
+
"metro-config": "~0.80.4",
|
|
34
|
+
"metro-resolver": "~0.80.4",
|
|
35
|
+
"node-fetch": "^2.6.7",
|
|
34
36
|
"tslib": "^2.3.0",
|
|
35
37
|
"tsconfig-paths": "^4.1.2",
|
|
36
38
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
37
|
-
"@nx/
|
|
38
|
-
"@nx/
|
|
39
|
-
"@nx/
|
|
40
|
-
"@nx/
|
|
41
|
-
"@nx/
|
|
42
|
-
"@nx/
|
|
43
|
-
"@
|
|
44
|
-
"@nrwl/expo": "18.0.0-beta.0"
|
|
45
|
-
},
|
|
46
|
-
"peerDependencies": {
|
|
47
|
-
"expo": ">= 49.0.0",
|
|
48
|
-
"@expo/cli": ">= 0.10.0",
|
|
49
|
-
"eas-cli": ">= 3.15.0"
|
|
39
|
+
"@nx/jest": "18.0.0-beta.2",
|
|
40
|
+
"@nx/js": "18.0.0-beta.2",
|
|
41
|
+
"@nx/eslint": "18.0.0-beta.2",
|
|
42
|
+
"@nx/react": "18.0.0-beta.2",
|
|
43
|
+
"@nx/web": "18.0.0-beta.2",
|
|
44
|
+
"@nx/webpack": "18.0.0-beta.2",
|
|
45
|
+
"@nrwl/expo": "18.0.0-beta.2"
|
|
50
46
|
},
|
|
51
47
|
"executors": "./executors.json",
|
|
52
48
|
"ng-update": {
|
|
@@ -27,6 +27,9 @@ function getResolveRequest(extensions) {
|
|
|
27
27
|
if (resolvedPath) {
|
|
28
28
|
return resolvedPath;
|
|
29
29
|
}
|
|
30
|
+
if (debug) {
|
|
31
|
+
console.log(chalk.red(`[Nx] Unable to resolve with any resolver: ${realModuleName}`));
|
|
32
|
+
}
|
|
30
33
|
throw new Error(`Cannot resolve ${chalk.bold(realModuleName)}`);
|
|
31
34
|
};
|
|
32
35
|
}
|
|
@@ -84,7 +87,7 @@ function tsconfigPathsResolver(context, extensions, realModuleName, platform, de
|
|
|
84
87
|
}
|
|
85
88
|
catch {
|
|
86
89
|
if (debug) {
|
|
87
|
-
console.log(chalk.
|
|
90
|
+
console.log(chalk.cyan(`[Nx] Failed to resolve ${chalk.bold(realModuleName)}`));
|
|
88
91
|
console.log(chalk.cyan(`[Nx] The following tsconfig paths was used:\n:${chalk.bold(JSON.stringify(paths, null, 2))}`));
|
|
89
92
|
}
|
|
90
93
|
}
|
package/plugins/plugin.js
CHANGED
|
@@ -58,17 +58,20 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
58
58
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
59
59
|
const targets = {
|
|
60
60
|
[options.startTargetName]: {
|
|
61
|
-
|
|
61
|
+
command: `expo start`,
|
|
62
|
+
options: { cwd: projectRoot },
|
|
62
63
|
},
|
|
63
64
|
[options.serveTargetName]: {
|
|
64
65
|
command: `expo start --web`,
|
|
65
66
|
options: { cwd: projectRoot },
|
|
66
67
|
},
|
|
67
68
|
[options.runIosTargetName]: {
|
|
68
|
-
|
|
69
|
+
command: `expo run:ios`,
|
|
70
|
+
options: { cwd: projectRoot },
|
|
69
71
|
},
|
|
70
72
|
[options.runAndroidTargetName]: {
|
|
71
|
-
|
|
73
|
+
command: `expo run:android`,
|
|
74
|
+
options: { cwd: projectRoot },
|
|
72
75
|
},
|
|
73
76
|
[options.exportTargetName]: {
|
|
74
77
|
command: `expo export`,
|
|
@@ -86,12 +89,12 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
86
89
|
executor: `@nx/expo:prebuild`,
|
|
87
90
|
},
|
|
88
91
|
[options.buildTargetName]: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
inputs: getInputs(namedInputs),
|
|
92
|
+
command: `eas build`,
|
|
93
|
+
options: { cwd: projectRoot },
|
|
92
94
|
},
|
|
93
95
|
[options.submitTargetName]: {
|
|
94
|
-
|
|
96
|
+
command: `eas submit`,
|
|
97
|
+
options: { cwd: projectRoot },
|
|
95
98
|
},
|
|
96
99
|
};
|
|
97
100
|
return targets;
|
package/plugins/with-nx-metro.js
CHANGED
|
@@ -11,14 +11,18 @@ async function withNxMetro(userConfig, opts = {}) {
|
|
|
11
11
|
process.env.NX_REACT_NATIVE_DEBUG = 'true';
|
|
12
12
|
if (opts.extensions)
|
|
13
13
|
extensions.push(...opts.extensions);
|
|
14
|
-
let watchFolders =
|
|
14
|
+
let watchFolders = (0, fs_extra_1.readdirSync)(devkit_1.workspaceRoot)
|
|
15
|
+
.filter((fileName) => !['dist', 'e2e'].includes(fileName) && !fileName.startsWith('.'))
|
|
16
|
+
.map((fileName) => (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, fileName))
|
|
17
|
+
.filter((filePath) => (0, fs_extra_1.statSync)(filePath).isDirectory());
|
|
15
18
|
if (opts.watchFolders?.length) {
|
|
16
19
|
watchFolders = watchFolders.concat(opts.watchFolders);
|
|
17
20
|
}
|
|
18
|
-
watchFolders = watchFolders.filter((folder) => (0, fs_extra_1.existsSync)(folder));
|
|
21
|
+
watchFolders = [...new Set(watchFolders)].filter((folder) => (0, fs_extra_1.existsSync)(folder));
|
|
19
22
|
const nxConfig = {
|
|
20
23
|
resolver: {
|
|
21
24
|
resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions),
|
|
25
|
+
nodeModulesPaths: [(0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'node_modules')],
|
|
22
26
|
},
|
|
23
27
|
watchFolders,
|
|
24
28
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @deprecated TODO(
|
|
2
|
+
* @deprecated TODO(v19) use bundler: 'metro' instead, will be removed in v19
|
|
3
3
|
* This function add additional rules to expo's webpack config to make expo web working
|
|
4
4
|
*/
|
|
5
5
|
export declare function withNxWebpack(config: any): Promise<any>;
|
|
@@ -4,12 +4,12 @@ exports.withNxWebpack = void 0;
|
|
|
4
4
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
/**
|
|
7
|
-
* @deprecated TODO(
|
|
7
|
+
* @deprecated TODO(v19) use bundler: 'metro' instead, will be removed in v19
|
|
8
8
|
* This function add additional rules to expo's webpack config to make expo web working
|
|
9
9
|
*/
|
|
10
10
|
async function withNxWebpack(config) {
|
|
11
11
|
// add additional rule to load files under libs
|
|
12
|
-
const rules = config.module.rules
|
|
12
|
+
const rules = config.module.rules.find((rule) => Array.isArray(rule.oneOf))?.oneOf;
|
|
13
13
|
if (rules) {
|
|
14
14
|
rules.push({
|
|
15
15
|
test: /\.(mjs|[jt]sx?)$/,
|
|
@@ -36,12 +36,16 @@ async function withNxWebpack(config) {
|
|
|
36
36
|
config.resolve.plugins = [];
|
|
37
37
|
}
|
|
38
38
|
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
39
|
-
const tsConfigPath = (0, path_1.resolve)('tsconfig.json');
|
|
39
|
+
const tsConfigPath = (0, path_1.resolve)(__dirname, 'tsconfig.json');
|
|
40
40
|
config.resolve.plugins.push(new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
|
|
41
41
|
configFile: tsConfigPath,
|
|
42
42
|
extensions,
|
|
43
43
|
}));
|
|
44
|
-
config.resolve.
|
|
44
|
+
config.resolve.fallback = {
|
|
45
|
+
...config.resolve.fallback,
|
|
46
|
+
crypto: require.resolve('crypto-browserify'),
|
|
47
|
+
stream: require.resolve('stream-browserify'),
|
|
48
|
+
};
|
|
45
49
|
return config;
|
|
46
50
|
}
|
|
47
51
|
exports.withNxWebpack = withNxWebpack;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const devkit_1 = require("@nx/devkit");
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
|
+
const resolve_eas_1 = require("../../utils/resolve-eas");
|
|
6
7
|
let childProcess;
|
|
7
8
|
async function* buildExecutor(options, context) {
|
|
8
9
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
@@ -19,7 +20,7 @@ async function* buildExecutor(options, context) {
|
|
|
19
20
|
exports.default = buildExecutor;
|
|
20
21
|
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
21
22
|
return new Promise((resolve, reject) => {
|
|
22
|
-
childProcess = (0, child_process_1.fork)(
|
|
23
|
+
childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['build', ...createBuildOptions(options)], {
|
|
23
24
|
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
24
25
|
env: process.env,
|
|
25
26
|
});
|
|
@@ -4,11 +4,10 @@ exports.runCliBuildList = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
|
-
const
|
|
7
|
+
const resolve_eas_1 = require("../../utils/resolve-eas");
|
|
8
8
|
let childProcess;
|
|
9
9
|
async function* buildListExecutor(options, context) {
|
|
10
10
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
11
|
-
(0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
|
|
12
11
|
try {
|
|
13
12
|
if (options.json) {
|
|
14
13
|
// when json is true, interactive has to be false
|
|
@@ -26,7 +25,7 @@ async function* buildListExecutor(options, context) {
|
|
|
26
25
|
exports.default = buildListExecutor;
|
|
27
26
|
function runCliBuildList(workspaceRoot, projectRoot, options) {
|
|
28
27
|
return new Promise((resolve, reject) => {
|
|
29
|
-
childProcess = (0, child_process_1.fork)(
|
|
28
|
+
childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['build:list', ...createBuildListOptions(options)], {
|
|
30
29
|
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
31
30
|
env: process.env,
|
|
32
31
|
stdio: ['inherit', 'pipe', 'inherit', 'ipc'], // only stream stdout on child process
|
|
@@ -2,4 +2,8 @@ import { ExecutorContext } from '@nx/devkit';
|
|
|
2
2
|
export interface ExpoEnsureSymlinkOutput {
|
|
3
3
|
success: boolean;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* TODO (@xiongemi): remove this function in v19.
|
|
7
|
+
* @deprecated It is no longer needed for react native 73.
|
|
8
|
+
*/
|
|
5
9
|
export default function ensureSymlinkExecutor(_: any, context: ExecutorContext): AsyncGenerator<ExpoEnsureSymlinkOutput>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
|
|
4
|
+
/**
|
|
5
|
+
* TODO (@xiongemi): remove this function in v19.
|
|
6
|
+
* @deprecated It is no longer needed for react native 73.
|
|
7
|
+
*/
|
|
4
8
|
async function* ensureSymlinkExecutor(_, context) {
|
|
5
9
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
6
10
|
(0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"outputCapture": "direct-nodejs",
|
|
4
4
|
"cli": "nx",
|
|
5
5
|
"$id": "NxExpoEnsureSymlink",
|
|
6
|
-
"$schema": "
|
|
6
|
+
"$schema": "https://json-schema.org/schema",
|
|
7
7
|
"title": "Ensure Symlink for Expo",
|
|
8
8
|
"description": "Ensure workspace node_modules is symlink under app's node_modules folder.",
|
|
9
9
|
"type": "object",
|
|
@@ -4,3 +4,4 @@ export interface ExpoExportOutput {
|
|
|
4
4
|
success: boolean;
|
|
5
5
|
}
|
|
6
6
|
export default function exportExecutor(options: ExportExecutorSchema, context: ExecutorContext): AsyncGenerator<ExpoExportOutput>;
|
|
7
|
+
export declare function createExportOptions(options: ExportExecutorSchema, projectRoot: string): any[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExportOptions = void 0;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const child_process_1 = require("child_process");
|
|
5
6
|
const path_1 = require("path");
|
|
@@ -21,11 +22,7 @@ async function* exportExecutor(options, context) {
|
|
|
21
22
|
exports.default = exportExecutor;
|
|
22
23
|
function exportAsync(workspaceRoot, projectRoot, options) {
|
|
23
24
|
return new Promise((resolve, reject) => {
|
|
24
|
-
childProcess = (0, child_process_1.fork)(require.resolve('@expo/cli/build/bin/cli'), [
|
|
25
|
-
`export${options.bundler === 'webpack' ? ':web' : ''}`,
|
|
26
|
-
'.',
|
|
27
|
-
...createExportOptions(options),
|
|
28
|
-
], { cwd: (0, path_1.resolve)(workspaceRoot, projectRoot), env: process.env });
|
|
25
|
+
childProcess = (0, child_process_1.fork)(require.resolve('@expo/cli/build/bin/cli'), [`export`, ...createExportOptions(options, projectRoot)], { cwd: (0, path_1.resolve)(workspaceRoot, projectRoot), env: process.env });
|
|
29
26
|
// Ensure the child process is killed when the parent exits
|
|
30
27
|
process.on('exit', () => childProcess.kill());
|
|
31
28
|
process.on('SIGTERM', () => childProcess.kill());
|
|
@@ -42,22 +39,35 @@ function exportAsync(workspaceRoot, projectRoot, options) {
|
|
|
42
39
|
});
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
|
-
const nxOptions = ['bundler'];
|
|
42
|
+
const nxOptions = ['bundler', 'interactive']; // interactive is passed in by e2e tests
|
|
46
43
|
// options from https://github.com/expo/expo/blob/main/packages/@expo/cli/src/export/index.ts
|
|
47
|
-
function createExportOptions(options) {
|
|
44
|
+
function createExportOptions(options, projectRoot) {
|
|
48
45
|
return Object.keys(options).reduce((acc, k) => {
|
|
49
46
|
if (!nxOptions.includes(k)) {
|
|
50
47
|
const v = options[k];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
acc.push(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
switch (k) {
|
|
49
|
+
case 'outputDir':
|
|
50
|
+
const path = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(projectRoot), v); // need to add offset for the outputDir
|
|
51
|
+
acc.push('--output-dir', path);
|
|
52
|
+
break;
|
|
53
|
+
case 'minify':
|
|
54
|
+
if (v === false) {
|
|
55
|
+
acc.push('--no-minify'); // cli only accpets --no-minify
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
if (typeof v === 'boolean') {
|
|
60
|
+
if (v === true) {
|
|
61
|
+
// when true, does not need to pass the value true, just need to pass the flag in kebob case
|
|
62
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
return acc;
|
|
62
71
|
}, []);
|
|
63
72
|
}
|
|
73
|
+
exports.createExportOptions = createExportOptions;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// options form https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/export/resolveOptions.ts
|
|
2
|
+
// https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/export/index.ts
|
|
3
|
+
|
|
2
4
|
export interface ExportExecutorSchema {
|
|
3
5
|
platform?: 'ios' | 'android' | 'all' | 'web'; // default is 'all'
|
|
4
6
|
outputDir?: string;
|
|
5
7
|
clear?: boolean;
|
|
6
8
|
dev?: boolean;
|
|
9
|
+
minify?: boolean;
|
|
7
10
|
maxWorkers?: number;
|
|
8
11
|
dumpAssetmap?: boolean;
|
|
9
|
-
|
|
10
|
-
bundler: 'metro' | 'webpack';
|
|
12
|
+
sourcemap?: boolean;
|
|
11
13
|
}
|