@nx/react-native 0.0.0-pr-22179-271588f → 0.0.0-pr-26515-856ef7f

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.
Files changed (71) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/migrations.json +78 -287
  4. package/package.json +11 -10
  5. package/plugins/plugin.js +17 -38
  6. package/plugins/with-nx-metro.js +3 -2
  7. package/project.json +1 -3
  8. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +1 -1
  9. package/src/executors/ensure-symlink/ensure-symlink.impl.js +1 -1
  10. package/src/executors/storybook/schema.d.ts +1 -0
  11. package/src/executors/storybook/storybook.impl.d.ts +1 -1
  12. package/src/executors/storybook/storybook.impl.js +10 -3
  13. package/src/generators/application/files/app/Gemfile.template +4 -2
  14. package/src/generators/application/files/app/android/app/build.gradle.template +0 -1
  15. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +1 -3
  16. package/src/generators/application/files/app/android/build.gradle.template +3 -3
  17. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  18. package/src/generators/application/files/app/android/gradlew.bat +10 -10
  19. package/src/generators/application/files/app/android/gradlew.template +7 -7
  20. package/src/generators/application/files/app/ios/Podfile.template +2 -17
  21. package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +2 -2
  22. package/src/generators/application/files/app/ios/__className__/Info.plist.template +1 -1
  23. package/src/generators/application/files/app/ios/__className__/PrivacyInfo.xcprivacy +38 -0
  24. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +5 -1
  25. package/src/generators/application/files/app/metro.config.js.template +1 -1
  26. package/src/generators/application/files/app/tsconfig.app.json.template +1 -1
  27. package/src/generators/application/lib/normalize-options.d.ts +3 -0
  28. package/src/generators/application/lib/normalize-options.js +23 -0
  29. package/src/generators/application/schema.json +2 -2
  30. package/src/generators/component/schema.d.ts +1 -1
  31. package/src/generators/component/schema.json +1 -1
  32. package/src/generators/init/init.js +44 -31
  33. package/src/generators/init/lib/gitignore-entries.d.ts +1 -1
  34. package/src/generators/init/lib/gitignore-entries.js +2 -2
  35. package/src/generators/library/files/lib/tsconfig.lib.json.template +1 -1
  36. package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +3 -3
  37. package/src/migrations/update-18-0-0/change-storybook-targets.js +1 -1
  38. package/src/utils/add-jest.js +2 -2
  39. package/src/utils/versions.d.ts +9 -9
  40. package/src/utils/versions.js +9 -9
  41. package/src/executors/build-android/build-android.impl.ts +0 -69
  42. package/src/executors/build-ios/build-ios.impl.ts +0 -77
  43. package/src/executors/bundle/bundle.impl.ts +0 -77
  44. package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -22
  45. package/src/executors/pod-install/pod-install.impl.ts +0 -21
  46. package/src/executors/run-android/run-android.impl.ts +0 -94
  47. package/src/executors/run-ios/run-ios.impl.ts +0 -92
  48. package/src/executors/start/start.impl.ts +0 -111
  49. package/src/executors/storybook/storybook.impl.ts +0 -85
  50. package/src/executors/sync-deps/sync-deps.impl.ts +0 -140
  51. package/src/executors/upgrade/upgrade.impl.ts +0 -64
  52. package/src/generators/application/application.spec.ts +0 -258
  53. package/src/generators/application/files/app/test-setup.ts.template +0 -1
  54. package/src/generators/application/lib/normalize-options.spec.ts +0 -196
  55. package/src/generators/component/component.spec.ts +0 -127
  56. package/src/generators/init/init.spec.ts +0 -38
  57. package/src/generators/library/files/lib/test-setup.ts.template +0 -1
  58. package/src/generators/library/library.spec.ts +0 -420
  59. package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +0 -2
  60. package/src/migrations/update-15-0-0/add-babel-inputs.js +0 -9
  61. package/src/migrations/update-15-0-0/add-babel-inputs.spec.ts +0 -73
  62. package/src/migrations/update-15-9-1/add-build-ios-target.d.ts +0 -5
  63. package/src/migrations/update-15-9-1/add-build-ios-target.js +0 -29
  64. package/src/migrations/update-15-9-1/add-build-ios-target.spec.ts +0 -36
  65. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts +0 -37
  66. package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +0 -39
  67. package/src/migrations/update-18-0-0/remove-block-list.spec.ts +0 -68
  68. package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +0 -40
  69. package/src/utils/add-linting.spec.ts +0 -40
  70. package/src/utils/ensure-node-modules-symlink.spec.ts +0 -108
  71. package/src/utils/find-all-npm-dependencies.spec.ts +0 -103
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2023 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
26
26
 
27
- This package is a [React Native plugin for Nx](https://nx.dev/packages/react-native).
27
+ This package is a [React Native plugin for Nx](https://nx.dev/nx-api/react-native).
28
28
 
29
29
  ## Getting Started
30
30
 
package/migrations.json CHANGED
@@ -1,17 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "add-babel-inputs": {
4
- "cli": "nx",
5
- "version": "15.0.0-beta.0",
6
- "description": "Adds babel.config.json to the hash of all tasks",
7
- "factory": "./src/migrations/update-15-0-0/add-babel-inputs"
8
- },
9
- "add-build-ios-target": {
10
- "cli": "nx",
11
- "version": "15.9.1-beta.0",
12
- "description": "Add target build-ios and pod-install for react native apps",
13
- "factory": "./src/migrations/update-15-9-1/add-build-ios-target"
14
- },
15
3
  "update-16-0-0-add-nx-packages": {
16
4
  "cli": "nx",
17
5
  "version": "16.0.0-beta.1",
@@ -80,281 +68,6 @@
80
68
  }
81
69
  },
82
70
  "packageJsonUpdates": {
83
- "15.0.0": {
84
- "version": "15.0.0-beta.0",
85
- "packages": {
86
- "metro": {
87
- "version": "0.72.3",
88
- "alwaysAddToPackageJson": false
89
- },
90
- "metro-resolver": {
91
- "version": "0.72.3",
92
- "alwaysAddToPackageJson": false
93
- },
94
- "metro-babel-register": {
95
- "version": "0.72.3",
96
- "alwaysAddToPackageJson": false
97
- },
98
- "metro-config": {
99
- "version": "0.72.3",
100
- "alwaysAddToPackageJson": false
101
- },
102
- "metro-react-native-babel-preset": {
103
- "version": "0.72.3",
104
- "alwaysAddToPackageJson": false
105
- },
106
- "metro-react-native-babel-transformer": {
107
- "version": "0.72.3",
108
- "alwaysAddToPackageJson": false
109
- },
110
- "@types/react-native": {
111
- "version": "0.70.4",
112
- "alwaysAddToPackageJson": false
113
- },
114
- "@testing-library/react-native": {
115
- "version": "11.2.0",
116
- "alwaysAddToPackageJson": false
117
- },
118
- "@testing-library/jest-native": {
119
- "version": "4.0.13",
120
- "alwaysAddToPackageJson": false
121
- }
122
- }
123
- },
124
- "15.2.2": {
125
- "version": "15.2.2-beta.0",
126
- "packages": {
127
- "react-native": {
128
- "version": "0.70.6",
129
- "alwaysAddToPackageJson": false
130
- },
131
- "@types/react-native": {
132
- "version": "0.70.6",
133
- "alwaysAddToPackageJson": false
134
- },
135
- "metro-resolver": {
136
- "version": "0.73.3",
137
- "alwaysAddToPackageJson": false
138
- },
139
- "metro-babel-register": {
140
- "version": "0.73.3",
141
- "alwaysAddToPackageJson": false
142
- },
143
- "metro-config": {
144
- "version": "0.73.3",
145
- "alwaysAddToPackageJson": false
146
- },
147
- "metro-react-native-babel-preset": {
148
- "version": "0.73.3",
149
- "alwaysAddToPackageJson": false
150
- },
151
- "metro-react-native-babel-transformer": {
152
- "version": "0.73.3",
153
- "alwaysAddToPackageJson": false
154
- },
155
- "react-native-config": {
156
- "version": "1.4.11",
157
- "alwaysAddToPackageJson": false
158
- },
159
- "@testing-library/react-native": {
160
- "version": "11.5.0",
161
- "alwaysAddToPackageJson": false
162
- },
163
- "@testing-library/jest-native": {
164
- "version": "5.3.0",
165
- "alwaysAddToPackageJson": false
166
- },
167
- "react-native-svg": {
168
- "version": "13.6.0",
169
- "alwaysAddToPackageJson": false
170
- },
171
- "@babel/runtime": {
172
- "version": "7.20.1",
173
- "alwaysAddToPackageJson": false
174
- },
175
- "@react-native-community/cli": {
176
- "version": "9.3.2",
177
- "alwaysAddToPackageJson": false
178
- },
179
- "@react-native-community/cli-platform-android": {
180
- "version": "9.3.1",
181
- "alwaysAddToPackageJson": false
182
- },
183
- "@react-native-community/cli-platform-ios": {
184
- "version": "9.3.0",
185
- "alwaysAddToPackageJson": false
186
- },
187
- "@react-native-async-storage/async-storage": {
188
- "version": "1.17.11",
189
- "alwaysAddToPackageJson": false
190
- }
191
- }
192
- },
193
- "15.6.2": {
194
- "version": "15.6.2-beta.0",
195
- "packages": {
196
- "react-native": {
197
- "version": "0.71.1",
198
- "alwaysAddToPackageJson": false
199
- },
200
- "@types/react-native": {
201
- "version": "0.71.0",
202
- "alwaysAddToPackageJson": false
203
- },
204
- "metro-resolver": {
205
- "version": "0.74.1",
206
- "alwaysAddToPackageJson": false
207
- },
208
- "metro-babel-register": {
209
- "version": "0.74.1",
210
- "alwaysAddToPackageJson": false
211
- },
212
- "metro-config": {
213
- "version": "0.74.1",
214
- "alwaysAddToPackageJson": false
215
- },
216
- "metro-react-native-babel-preset": {
217
- "version": "0.74.1",
218
- "alwaysAddToPackageJson": false
219
- },
220
- "metro-react-native-babel-transformer": {
221
- "version": "0.74.1",
222
- "alwaysAddToPackageJson": false
223
- },
224
- "react-native-config": {
225
- "version": "1.4.12",
226
- "alwaysAddToPackageJson": false
227
- },
228
- "@testing-library/jest-native": {
229
- "version": "5.4.1",
230
- "alwaysAddToPackageJson": false
231
- },
232
- "react-native-svg": {
233
- "version": "13.7.0",
234
- "alwaysAddToPackageJson": false
235
- },
236
- "@babel/runtime": {
237
- "version": "7.20.7",
238
- "alwaysAddToPackageJson": false
239
- },
240
- "@react-native-community/cli": {
241
- "version": "10.1.3",
242
- "alwaysAddToPackageJson": false
243
- },
244
- "@react-native-community/cli-platform-android": {
245
- "version": "10.1.3",
246
- "alwaysAddToPackageJson": false
247
- },
248
- "@react-native-community/cli-platform-ios": {
249
- "version": "10.1.1",
250
- "alwaysAddToPackageJson": false
251
- },
252
- "@types/node": {
253
- "version": "18.11.18",
254
- "alwaysAddToPackageJson": false
255
- },
256
- "react": {
257
- "version": "18.2.0",
258
- "alwaysAddToPackageJson": false
259
- },
260
- "react-dom": {
261
- "version": "18.2.0",
262
- "alwaysAddToPackageJson": false
263
- },
264
- "react-test-renderer": {
265
- "version": "18.2.0",
266
- "alwaysAddToPackageJson": false
267
- }
268
- }
269
- },
270
- "15.7.1": {
271
- "version": "15.7.1-beta.0",
272
- "packages": {
273
- "react-native": {
274
- "version": "0.71.2",
275
- "alwaysAddToPackageJson": false
276
- },
277
- "@types/react-native": {
278
- "version": "0.71.2",
279
- "alwaysAddToPackageJson": false
280
- },
281
- "react-native-config": {
282
- "version": "1.5.0",
283
- "alwaysAddToPackageJson": false
284
- },
285
- "@testing-library/react-native": {
286
- "version": "11.5.2",
287
- "alwaysAddToPackageJson": false
288
- },
289
- "react-native-svg": {
290
- "version": "13.8.0",
291
- "alwaysAddToPackageJson": false
292
- },
293
- "@babel/runtime": {
294
- "version": "7.20.13",
295
- "alwaysAddToPackageJson": false
296
- }
297
- }
298
- },
299
- "15.8.3": {
300
- "version": "15.8.3-beta.0",
301
- "packages": {
302
- "react-native": {
303
- "version": "0.71.3",
304
- "alwaysAddToPackageJson": false
305
- },
306
- "@types/react-native": {
307
- "version": "0.71.3",
308
- "alwaysAddToPackageJson": false
309
- },
310
- "@types/node": {
311
- "version": "18.14.4",
312
- "alwaysAddToPackageJson": false
313
- },
314
- "@react-native-community/cli": {
315
- "version": "10.2.0",
316
- "alwaysAddToPackageJson": false
317
- },
318
- "@react-native-community/cli-platform-android": {
319
- "version": "10.2.0",
320
- "alwaysAddToPackageJson": false
321
- },
322
- "@react-native-community/cli-platform-ios": {
323
- "version": "10.2.0",
324
- "alwaysAddToPackageJson": false
325
- },
326
- "@testing-library/jest-native": {
327
- "version": "5.4.2",
328
- "alwaysAddToPackageJson": false
329
- },
330
- "@babel/runtime": {
331
- "version": "7.21.0",
332
- "alwaysAddToPackageJson": false
333
- }
334
- }
335
- },
336
- "15.8.6": {
337
- "version": "15.8.6-beta.0",
338
- "packages": {
339
- "react-native": {
340
- "version": "0.71.4",
341
- "alwaysAddToPackageJson": false
342
- }
343
- }
344
- },
345
- "15.9.1": {
346
- "version": "15.9.1-beta.0",
347
- "packages": {
348
- "@react-native-community/cli": {
349
- "version": "10.2.1",
350
- "alwaysAddToPackageJson": false
351
- },
352
- "@react-native-community/cli-platform-ios": {
353
- "version": "10.2.1",
354
- "alwaysAddToPackageJson": false
355
- }
356
- }
357
- },
358
71
  "16.0.0": {
359
72
  "version": "16.0.0-beta.0",
360
73
  "packages": {
@@ -627,6 +340,84 @@
627
340
  "alwaysAddToPackageJson": false
628
341
  }
629
342
  }
343
+ },
344
+ "19.0.0": {
345
+ "version": "19.0.0-beta.7",
346
+ "packages": {
347
+ "react-native": {
348
+ "version": "0.73.6",
349
+ "alwaysAddToPackageJson": false
350
+ },
351
+ "@react-native-community/cli-platform-android": {
352
+ "version": "~12.3.6",
353
+ "alwaysAddToPackageJson": false
354
+ },
355
+ "@react-native/babel-preset": {
356
+ "version": "^0.73.21",
357
+ "alwaysAddToPackageJson": false
358
+ },
359
+ "@react-native/metro-config": {
360
+ "version": "^0.73.5",
361
+ "alwaysAddToPackageJson": false
362
+ },
363
+ "react-native-web": {
364
+ "version": "^0.19.10",
365
+ "alwaysAddToPackageJson": false
366
+ },
367
+ "@testing-library/react-native": {
368
+ "version": "~12.4.5",
369
+ "alwaysAddToPackageJson": false
370
+ },
371
+ "react-native-svg-transformer": {
372
+ "version": "1.3.0",
373
+ "alwaysAddToPackageJson": false
374
+ },
375
+ "react-native-svg": {
376
+ "version": "15.1.0",
377
+ "alwaysAddToPackageJson": false
378
+ },
379
+ "@babel/runtime": {
380
+ "version": "7.24.4",
381
+ "alwaysAddToPackageJson": false
382
+ }
383
+ }
384
+ },
385
+ "19.2.0": {
386
+ "version": "19.2.0-beta.2",
387
+ "packages": {
388
+ "react-native": {
389
+ "version": "0.74.1",
390
+ "alwaysAddToPackageJson": false
391
+ },
392
+ "@react-native-community/cli-platform-android": {
393
+ "version": "~13.6.6",
394
+ "alwaysAddToPackageJson": false
395
+ },
396
+ "@react-native/babel-preset": {
397
+ "version": "^0.74.83",
398
+ "alwaysAddToPackageJson": false
399
+ },
400
+ "@react-native/metro-config": {
401
+ "version": "^0.74.83",
402
+ "alwaysAddToPackageJson": false
403
+ },
404
+ "react-native-web": {
405
+ "version": "^0.19.11",
406
+ "alwaysAddToPackageJson": false
407
+ },
408
+ "@testing-library/react-native": {
409
+ "version": "~12.5.0",
410
+ "alwaysAddToPackageJson": false
411
+ },
412
+ "react-native-svg": {
413
+ "version": "15.2.0",
414
+ "alwaysAddToPackageJson": false
415
+ },
416
+ "@babel/runtime": {
417
+ "version": "7.24.5",
418
+ "alwaysAddToPackageJson": false
419
+ }
420
+ }
630
421
  }
631
422
  }
632
423
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "0.0.0-pr-22179-271588f",
3
+ "version": "0.0.0-pr-26515-856ef7f",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
6
6
  "keywords": [
@@ -9,7 +9,8 @@
9
9
  "Web",
10
10
  "Jest",
11
11
  "Native",
12
- "CLI"
12
+ "CLI",
13
+ "Mobile"
13
14
  ],
14
15
  "homepage": "https://nx.dev",
15
16
  "bugs": {
@@ -22,7 +23,7 @@
22
23
  },
23
24
  "license": "MIT",
24
25
  "author": "Victor Savkin",
25
- "main": "./index.js",
26
+ "main": "./index",
26
27
  "types": "index.d.ts",
27
28
  "dependencies": {
28
29
  "ajv": "^8.12.0",
@@ -36,13 +37,13 @@
36
37
  "node-fetch": "^2.6.7",
37
38
  "tsconfig-paths": "^4.1.2",
38
39
  "tslib": "^2.3.0",
39
- "@nx/devkit": "0.0.0-pr-22179-271588f",
40
- "@nx/jest": "0.0.0-pr-22179-271588f",
41
- "@nx/js": "0.0.0-pr-22179-271588f",
42
- "@nx/eslint": "0.0.0-pr-22179-271588f",
43
- "@nx/react": "0.0.0-pr-22179-271588f",
44
- "@nx/workspace": "0.0.0-pr-22179-271588f",
45
- "@nrwl/react-native": "0.0.0-pr-22179-271588f"
40
+ "@nx/devkit": "0.0.0-pr-26515-856ef7f",
41
+ "@nx/jest": "0.0.0-pr-26515-856ef7f",
42
+ "@nx/js": "0.0.0-pr-26515-856ef7f",
43
+ "@nx/eslint": "0.0.0-pr-26515-856ef7f",
44
+ "@nx/react": "0.0.0-pr-26515-856ef7f",
45
+ "@nx/workspace": "0.0.0-pr-26515-856ef7f",
46
+ "@nrwl/react-native": "0.0.0-pr-26515-856ef7f"
46
47
  },
47
48
  "executors": "./executors.json",
48
49
  "ng-update": {
package/plugins/plugin.js CHANGED
@@ -8,23 +8,27 @@ const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
8
8
  const fs_1 = require("fs");
9
9
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
10
10
  const cache_directory_1 = require("nx/src/utils/cache-directory");
11
- const cachePath = (0, path_1.join)(cache_directory_1.projectGraphCacheDirectory, 'react-native.hash');
12
- const targetsCache = (0, fs_1.existsSync)(cachePath) ? readTargetsCache() : {};
13
- const calculatedTargets = {};
11
+ const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
12
+ const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'react-native.hash');
13
+ const targetsCache = readTargetsCache();
14
14
  function readTargetsCache() {
15
- return (0, devkit_1.readJsonFile)(cachePath);
15
+ return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
16
16
  }
17
- function writeTargetsToCache(targets) {
18
- (0, devkit_1.writeJsonFile)(cachePath, targets);
17
+ function writeTargetsToCache() {
18
+ const oldCache = readTargetsCache();
19
+ (0, devkit_1.writeJsonFile)(cachePath, {
20
+ ...oldCache,
21
+ ...targetsCache,
22
+ });
19
23
  }
20
24
  const createDependencies = () => {
21
- writeTargetsToCache(calculatedTargets);
25
+ writeTargetsToCache();
22
26
  return [];
23
27
  };
24
28
  exports.createDependencies = createDependencies;
25
29
  exports.createNodes = [
26
30
  '**/app.{json,config.js}',
27
- (configFilePath, options, context) => {
31
+ async (configFilePath, options, context) => {
28
32
  options = normalizeOptions(options);
29
33
  const projectRoot = (0, path_1.dirname)(configFilePath);
30
34
  // Do not create a project if package.json or project.json or metro.config.js isn't there.
@@ -33,21 +37,16 @@ exports.createNodes = [
33
37
  !siblingFiles.includes('metro.config.js')) {
34
38
  return {};
35
39
  }
36
- const appConfig = getAppConfig(configFilePath, context);
40
+ const appConfig = await getAppConfig(configFilePath, context);
37
41
  if (appConfig.expo) {
38
42
  return {};
39
43
  }
40
- const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
41
- (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
42
- ]);
43
- const targets = targetsCache[hash]
44
- ? targetsCache[hash]
45
- : buildReactNativeTargets(projectRoot, options, context);
46
- calculatedTargets[hash] = targets;
44
+ const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
45
+ targetsCache[hash] ??= buildReactNativeTargets(projectRoot, options, context);
47
46
  return {
48
47
  projects: {
49
48
  [projectRoot]: {
50
- targets,
49
+ targets: targetsCache[hash],
51
50
  },
52
51
  },
53
52
  };
@@ -64,12 +63,6 @@ function buildReactNativeTargets(projectRoot, options, context) {
64
63
  command: `pod install`,
65
64
  options: { cwd: (0, devkit_1.joinPathFragments)(projectRoot, 'ios') },
66
65
  dependsOn: [`${options.syncDepsTargetName}`],
67
- cache: true,
68
- inputs: getInputs(namedInputs),
69
- outputs: [
70
- getOutputs(projectRoot, 'ios/Pods'),
71
- getOutputs(projectRoot, 'ios/Podfile.lock'),
72
- ],
73
66
  },
74
67
  [options.runIosTargetName]: {
75
68
  command: `react-native run-ios`,
@@ -113,8 +106,7 @@ function buildReactNativeTargets(projectRoot, options, context) {
113
106
  }
114
107
  function getAppConfig(configFilePath, context) {
115
108
  const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
116
- let module = load(resolvedPath);
117
- return module.default ?? module;
109
+ return (0, config_utils_1.loadConfigFile)(resolvedPath);
118
110
  }
119
111
  function getInputs(namedInputs) {
120
112
  return [
@@ -134,19 +126,6 @@ function getOutputs(projectRoot, dir) {
134
126
  return `{workspaceRoot}/${projectRoot}/${dir}`;
135
127
  }
136
128
  }
137
- /**
138
- * Load the module after ensuring that the require cache is cleared.
139
- */
140
- function load(path) {
141
- // Clear cache if the path is in the cache
142
- if (require.cache[path]) {
143
- for (const k of Object.keys(require.cache)) {
144
- delete require.cache[k];
145
- }
146
- }
147
- // Then require
148
- return require(path);
149
- }
150
129
  function normalizeOptions(options) {
151
130
  options ??= {};
152
131
  options.startTargetName ??= 'start';
@@ -4,6 +4,7 @@ exports.withNxMetro = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const metro_config_1 = require("metro-config");
6
6
  const fs_extra_1 = require("fs-extra");
7
+ const path_1 = require("path");
7
8
  const metro_resolver_1 = require("./metro-resolver");
8
9
  async function withNxMetro(userConfig, opts = {}) {
9
10
  const extensions = ['', 'ts', 'tsx', 'js', 'jsx', 'json'];
@@ -13,7 +14,7 @@ async function withNxMetro(userConfig, opts = {}) {
13
14
  extensions.push(...opts.extensions);
14
15
  let watchFolders = (0, fs_extra_1.readdirSync)(devkit_1.workspaceRoot)
15
16
  .filter((fileName) => !['dist', 'e2e'].includes(fileName) && !fileName.startsWith('.'))
16
- .map((fileName) => (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, fileName))
17
+ .map((fileName) => (0, path_1.join)(devkit_1.workspaceRoot, fileName))
17
18
  .filter((filePath) => (0, fs_extra_1.statSync)(filePath).isDirectory());
18
19
  if (opts.watchFolders?.length) {
19
20
  watchFolders = watchFolders.concat(opts.watchFolders);
@@ -22,7 +23,7 @@ async function withNxMetro(userConfig, opts = {}) {
22
23
  const nxConfig = {
23
24
  resolver: {
24
25
  resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions),
25
- nodeModulesPaths: [(0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'node_modules')],
26
+ nodeModulesPaths: [(0, path_1.join)(devkit_1.workspaceRoot, 'node_modules')],
26
27
  },
27
28
  watchFolders,
28
29
  };
package/project.json CHANGED
@@ -4,8 +4,6 @@
4
4
  "sourceRoot": "packages/react-native/src",
5
5
  "projectType": "library",
6
6
  "targets": {
7
- "lint": {},
8
- "test": {},
9
7
  "build-base": {
10
8
  "executor": "@nx/js:tsc",
11
9
  "options": {
@@ -18,7 +16,7 @@
18
16
  },
19
17
  {
20
18
  "input": "packages/react-native/src",
21
- "glob": "**/*.!(ts)",
19
+ "glob": "**/!(*.ts)",
22
20
  "output": "/src"
23
21
  },
24
22
  {
@@ -3,7 +3,7 @@ export interface ReactNativeEnsureSymlinkOutput {
3
3
  success: boolean;
4
4
  }
5
5
  /**
6
- * TODO (@xiongemi): remove this function in v19.
6
+ * TODO (@xiongemi): remove this function in v20.
7
7
  * @deprecated It is no longer needed for react native 73.
8
8
  */
9
9
  export default function ensureSymlinkExecutor(_: any, context: ExecutorContext): AsyncGenerator<ReactNativeEnsureSymlinkOutput>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
4
4
  /**
5
- * TODO (@xiongemi): remove this function in v19.
5
+ * TODO (@xiongemi): remove this function in v20.
6
6
  * @deprecated It is no longer needed for react native 73.
7
7
  */
8
8
  async function* ensureSymlinkExecutor(_, context) {
@@ -2,4 +2,5 @@ export interface ReactNativeStorybookOptions {
2
2
  searchDir: string[];
3
3
  outputFile: string;
4
4
  pattern: string;
5
+ syncDeps?: boolean;
5
6
  }
@@ -1,7 +1,7 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { ReactNativeStorybookOptions } from './schema';
3
3
  /**
4
- * TODO (@xiongemi): remove this function in v19.
4
+ * TODO (@xiongemi): remove this function in v20.
5
5
  * @deprecated Going to use the default react storybook target. Use @nx/react:storybook executor instead.
6
6
  */
7
7
  export default function reactNativeStorybookExecutor(options: ReactNativeStorybookOptions, context: ExecutorContext): AsyncGenerator<{
@@ -9,10 +9,11 @@ const glob_1 = require("glob");
9
9
  const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
10
10
  const fs_extra_1 = require("fs-extra");
11
11
  /**
12
- * TODO (@xiongemi): remove this function in v19.
12
+ * TODO (@xiongemi): remove this function in v20.
13
13
  * @deprecated Going to use the default react storybook target. Use @nx/react:storybook executor instead.
14
14
  */
15
15
  async function* reactNativeStorybookExecutor(options, context) {
16
+ const { syncDeps: isSyncDepsEnabled = true } = options;
16
17
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
17
18
  devkit_1.logger.info(`${chalk.bold.cyan('info')} To see your Storybook stories on the device, you should start your mobile app for the <platform> of your choice (typically ios or android).`);
18
19
  // add storybook addons to app's package.json
@@ -20,7 +21,7 @@ async function* reactNativeStorybookExecutor(options, context) {
20
21
  const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
21
22
  const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
22
23
  const projectPackageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
23
- if ((0, fileutils_1.fileExists)(packageJsonPath))
24
+ if (isSyncDepsEnabled && (0, fileutils_1.fileExists)(packageJsonPath))
24
25
  (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectPackageJson, packageJsonPath, workspacePackageJson, context.projectGraph, [
25
26
  `@storybook/react-native`,
26
27
  '@storybook/addon-ondevice-actions',
@@ -35,7 +36,13 @@ async function* reactNativeStorybookExecutor(options, context) {
35
36
  }
36
37
  exports.default = reactNativeStorybookExecutor;
37
38
  function runCliStorybook(workspaceRoot, options) {
38
- const storiesFiles = options.searchDir.flatMap((dir) => (0, glob_1.sync)((0, path_1.join)(dir, options.pattern)));
39
+ const storiesFiles = options.searchDir.flatMap((dir) => {
40
+ const storyFilePaths = (0, glob_1.sync)((0, path_1.join)(dir, options.pattern));
41
+ return storyFilePaths.map((storyFilePath) => {
42
+ const loaderPath = (0, path_1.resolve)((0, path_1.dirname)(options.outputFile));
43
+ return (0, path_1.relative)(loaderPath, storyFilePath);
44
+ });
45
+ });
39
46
  if (storiesFiles.length === 0) {
40
47
  devkit_1.logger.warn(`${chalk.bold.yellow('warn')} No stories found.`);
41
48
  }