@nx/react-native 17.0.4 → 17.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.eslintrc.json +1 -7
  2. package/LICENSE +1 -1
  3. package/README.md +4 -9
  4. package/executors.json +0 -5
  5. package/generators.json +11 -12
  6. package/migrations.json +0 -126
  7. package/package.json +15 -11
  8. package/plugins/metro-resolver.js +1 -4
  9. package/plugins/with-nx-metro.js +2 -6
  10. package/src/executors/build-android/build-android.impl.js +6 -2
  11. package/src/executors/build-android/build-android.impl.ts +6 -2
  12. package/src/executors/build-android/schema.json +1 -1
  13. package/src/executors/build-ios/schema.json +1 -1
  14. package/src/executors/bundle/schema.d.ts +1 -1
  15. package/src/executors/bundle/schema.json +1 -1
  16. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +0 -4
  17. package/src/executors/ensure-symlink/ensure-symlink.impl.js +0 -4
  18. package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -4
  19. package/src/executors/ensure-symlink/schema.json +1 -1
  20. package/src/executors/pod-install/schema.json +1 -1
  21. package/src/executors/run-android/run-android.impl.js +17 -5
  22. package/src/executors/run-android/run-android.impl.ts +18 -9
  23. package/src/executors/run-android/schema.json +1 -1
  24. package/src/executors/run-ios/run-ios.impl.js +16 -4
  25. package/src/executors/run-ios/run-ios.impl.ts +18 -9
  26. package/src/executors/run-ios/schema.json +1 -1
  27. package/src/executors/start/schema.d.ts +1 -1
  28. package/src/executors/start/schema.json +1 -1
  29. package/src/executors/start/start.impl.js +26 -11
  30. package/src/executors/start/start.impl.ts +28 -14
  31. package/src/executors/storybook/storybook.impl.d.ts +0 -4
  32. package/src/executors/storybook/storybook.impl.js +2 -15
  33. package/src/executors/storybook/storybook.impl.ts +7 -26
  34. package/src/executors/sync-deps/schema.d.ts +0 -1
  35. package/src/executors/sync-deps/schema.json +1 -6
  36. package/src/executors/sync-deps/sync-deps.impl.d.ts +1 -2
  37. package/src/executors/sync-deps/sync-deps.impl.js +11 -33
  38. package/src/executors/sync-deps/sync-deps.impl.ts +18 -57
  39. package/src/generators/application/application.js +8 -52
  40. package/src/generators/application/application.spec.ts +2 -29
  41. package/src/generators/application/files/app/Gemfile.template +1 -2
  42. package/src/generators/application/files/app/android/app/build.gradle.template +28 -12
  43. package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +6 -2
  44. package/src/generators/application/files/app/android/app/src/debug/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +75 -0
  45. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +32 -0
  46. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +62 -0
  47. package/src/generators/application/files/app/android/app/src/release/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +20 -0
  48. package/src/generators/application/files/app/android/build.gradle.template +20 -7
  49. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -2
  50. package/src/generators/application/files/app/android/gradle.properties +3 -0
  51. package/src/generators/application/files/app/android/gradlew.template +7 -12
  52. package/src/generators/application/files/app/android/settings.gradle.template +2 -2
  53. package/src/generators/application/files/app/babel.config.json.template +3 -0
  54. package/src/generators/application/files/app/ios/Podfile.template +7 -0
  55. package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +0 -5
  56. package/src/generators/application/files/app/ios/__className__/Info.plist.template +8 -5
  57. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +33 -11
  58. package/src/generators/application/files/app/metro.config.js.template +5 -1
  59. package/src/generators/application/files/app/src/app/App.tsx.template +13 -50
  60. package/src/generators/application/lib/add-detox.d.ts +3 -0
  61. package/src/generators/application/lib/add-detox.js +23 -0
  62. package/src/generators/application/lib/add-project.js +18 -18
  63. package/src/generators/application/lib/normalize-options.d.ts +0 -7
  64. package/src/generators/application/lib/normalize-options.js +3 -35
  65. package/src/generators/application/lib/normalize-options.spec.ts +7 -70
  66. package/src/generators/application/schema.d.ts +3 -5
  67. package/src/generators/application/schema.json +6 -14
  68. package/src/generators/component/files/__fileName__.tsx__tmpl__ +1 -1
  69. package/src/generators/component/schema.d.ts +3 -3
  70. package/src/generators/component/schema.json +4 -4
  71. package/src/generators/component-story/component-story.d.ts +8 -5
  72. package/src/generators/component-story/component-story.js +69 -8
  73. package/src/generators/component-story/component-story.spec.ts +428 -0
  74. package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
  75. package/src/generators/component-story/schema.d.ts +0 -1
  76. package/src/generators/component-story/schema.json +3 -11
  77. package/src/generators/init/init.d.ts +1 -2
  78. package/src/generators/init/init.js +56 -55
  79. package/src/generators/init/init.spec.ts +6 -7
  80. package/src/generators/init/schema.d.ts +3 -3
  81. package/src/generators/init/schema.json +18 -13
  82. package/src/generators/library/files/lib/babel.config.json.template +17 -0
  83. package/src/generators/library/lib/normalize-options.js +0 -5
  84. package/src/generators/library/library.js +38 -48
  85. package/src/generators/library/library.spec.ts +60 -12
  86. package/src/generators/library/schema.d.ts +0 -1
  87. package/src/generators/library/schema.json +2 -2
  88. package/src/generators/stories/schema.d.ts +0 -2
  89. package/src/generators/stories/schema.json +2 -15
  90. package/src/generators/stories/stories-app.spec.ts +128 -0
  91. package/src/generators/stories/stories-lib.spec.ts +105 -0
  92. package/src/generators/stories/stories.d.ts +2 -5
  93. package/src/generators/stories/stories.js +50 -7
  94. package/src/generators/storybook-configuration/configuration.d.ts +2 -7
  95. package/src/generators/storybook-configuration/configuration.js +48 -18
  96. package/src/generators/storybook-configuration/configuration.spec.ts +135 -0
  97. package/src/generators/storybook-configuration/files/app/storybook.ts.template +9 -0
  98. package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +74 -0
  99. package/src/generators/storybook-configuration/files/root/story-loader.ts.template +5 -0
  100. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.d.ts +6 -0
  101. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js +25 -0
  102. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +161 -0
  103. package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +6 -0
  104. package/src/generators/storybook-configuration/lib/create-storybook-files.js +42 -0
  105. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +7 -0
  106. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +29 -0
  107. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +65 -0
  108. package/src/generators/storybook-configuration/schema.d.ts +2 -4
  109. package/src/generators/storybook-configuration/schema.json +12 -22
  110. package/src/generators/upgrade-native/lib/normalize-options.d.ts +1 -1
  111. package/src/generators/upgrade-native/schema.d.ts +1 -1
  112. package/src/generators/upgrade-native/schema.json +3 -3
  113. package/src/generators/upgrade-native/upgrade-native.d.ts +0 -2
  114. package/src/generators/upgrade-native/upgrade-native.js +0 -3
  115. package/src/migrations/update-16-6-0/update-metro-config.js +5 -1
  116. package/src/migrations/update-16-9-0/remove-types-react-native.js +9 -2
  117. package/src/utils/add-jest.d.ts +1 -1
  118. package/src/utils/add-jest.js +1 -13
  119. package/src/utils/add-linting.d.ts +0 -1
  120. package/src/utils/add-linting.js +1 -1
  121. package/src/utils/add-linting.spec.ts +6 -4
  122. package/src/utils/chmod-android-gradle-files.js +2 -6
  123. package/src/utils/find-all-npm-dependencies.js +3 -5
  124. package/src/utils/find-all-npm-dependencies.spec.ts +9 -17
  125. package/src/utils/symlink-task.d.ts +2 -0
  126. package/src/utils/symlink-task.js +18 -0
  127. package/src/utils/testing-generators.js +0 -1
  128. package/src/utils/versions.d.ts +13 -10
  129. package/src/utils/versions.js +14 -11
  130. package/plugin.d.ts +0 -1
  131. package/plugin.js +0 -6
  132. package/plugins/plugin.d.ts +0 -14
  133. package/plugins/plugin.js +0 -162
  134. package/src/executors/upgrade/schema.d.ts +0 -1
  135. package/src/executors/upgrade/schema.json +0 -11
  136. package/src/executors/upgrade/upgrade.impl.d.ts +0 -13
  137. package/src/executors/upgrade/upgrade.impl.js +0 -47
  138. package/src/executors/upgrade/upgrade.impl.ts +0 -64
  139. package/src/generators/application/files/app/.babelrc.js.template +0 -23
  140. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +0 -22
  141. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +0 -45
  142. package/src/generators/application/lib/add-e2e.d.ts +0 -3
  143. package/src/generators/application/lib/add-e2e.js +0 -46
  144. package/src/generators/library/files/lib/.babelrc.js.template +0 -21
  145. package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +0 -23
  146. package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +0 -15
  147. package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
  148. package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
  149. package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +0 -9
  150. package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +0 -82
  151. package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +0 -23
  152. package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
  153. package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
  154. package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +0 -14
  155. package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +0 -9
  156. package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +0 -77
  157. package/src/generators/web-configuration/lib/normalize-schema.d.ts +0 -17
  158. package/src/generators/web-configuration/lib/normalize-schema.js +0 -16
  159. package/src/generators/web-configuration/lib/webpack-targets.d.ts +0 -7
  160. package/src/generators/web-configuration/lib/webpack-targets.js +0 -75
  161. package/src/generators/web-configuration/schema.d.ts +0 -6
  162. package/src/generators/web-configuration/schema.json +0 -42
  163. package/src/generators/web-configuration/web-configuration.d.ts +0 -12
  164. package/src/generators/web-configuration/web-configuration.js +0 -87
  165. package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +0 -6
  166. package/src/migrations/update-18-0-0/add-upgrade-target.js +0 -33
  167. package/src/migrations/update-18-0-0/add-web-configuration.d.ts +0 -8
  168. package/src/migrations/update-18-0-0/add-web-configuration.js +0 -33
  169. package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +0 -39
  170. package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +0 -5
  171. package/src/migrations/update-18-0-0/change-storybook-targets.js +0 -57
  172. package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
  173. package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
  174. package/src/migrations/update-18-0-0/remove-block-list.spec.ts +0 -68
  175. package/src/migrations/update-18-0-0/remove-metro.d.ts +0 -14
  176. package/src/migrations/update-18-0-0/remove-metro.js +0 -29
  177. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
  178. package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -30
  179. package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +0 -40
  180. package/src/utils/ensure-dependencies.d.ts +0 -2
  181. package/src/utils/ensure-dependencies.js +0 -30
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- /**
5
- * Remove metro-* package since it is no longer explicity required in package.json.
6
- * react-native has dependency of @react-native/community-cli-plugin
7
- * @react-native/community-cli-plugin has dependency of metro
8
- *
9
- * Also remove @react-native-community/cli-* since it is a dependency of react-native.
10
- * (excpet reactNativeCommunityCliPlatformAndroidVersion because android files refer it by path)
11
- *
12
- * https://react-native-community.github.io/upgrade-helper/?from=0.72.6&to=0.73.1#RnDiffApp-package.json
13
- * @param tree
14
- * @returns
15
- */
16
- async function update(tree) {
17
- (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], [
18
- 'metro',
19
- 'metro-resolver',
20
- 'metro-config',
21
- 'metro-react-native-babel-preset',
22
- 'metro-babel-register',
23
- 'metro-react-native-babel-transformer',
24
- '@react-native-community/cli',
25
- '@react-native-community/cli-platform-ios',
26
- ]);
27
- await (0, devkit_1.formatFiles)(tree);
28
- }
29
- exports.default = update;
@@ -1,6 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Remove ensure-symlink target.
4
- * It is going to be supported by react-native version 0.73 by default.
5
- */
6
- export default function update(tree: Tree): Promise<void>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const fs_extra_1 = require("fs-extra");
5
- /**
6
- * Remove ensure-symlink target.
7
- * It is going to be supported by react-native version 0.73 by default.
8
- */
9
- async function update(tree) {
10
- const projects = (0, devkit_1.getProjects)(tree);
11
- for (const [projectName, config] of projects.entries()) {
12
- if (config.targets?.['ensure-symlink']?.executor ===
13
- '@nx/react-native:ensure-symlink') {
14
- removeTargets(config.targets, 'ensure-symlink');
15
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
16
- (0, fs_extra_1.removeSync)(`${config.root}/node_modules`);
17
- }
18
- }
19
- }
20
- exports.default = update;
21
- function removeTargets(targets, targetNameToRemove) {
22
- for (const targetName in targets) {
23
- if (targetName === targetNameToRemove) {
24
- delete targets[targetName];
25
- }
26
- if (targets[targetName]?.dependsOn?.length) {
27
- targets[targetName].dependsOn = targets[targetName].dependsOn.filter((dependsOn) => dependsOn !== targetNameToRemove);
28
- }
29
- }
30
- }
@@ -1,40 +0,0 @@
1
- import { addProjectConfiguration, getProjects, Tree } from '@nx/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3
- import update from './remove-symlink-target';
4
-
5
- describe('remove-symlink-target', () => {
6
- let tree: Tree;
7
-
8
- beforeEach(async () => {
9
- tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
10
- addProjectConfiguration(tree, 'product', {
11
- root: 'apps/product',
12
- sourceRoot: 'apps/product/src',
13
- targets: {
14
- 'ensure-symlink': {
15
- executor: '@nx/react-native:ensure-symlink',
16
- options: {},
17
- },
18
- 'bundle-android': {
19
- executor: '@nx/react-native:bundle',
20
- dependsOn: ['ensure-symlink'],
21
- outputs: ['{options.bundleOutput}'],
22
- options: {
23
- entryFile: 'src/main.tsx',
24
- platform: 'android',
25
- bundleOutput: 'dist/apps/techy-jokes/android/main.jsbundle',
26
- },
27
- },
28
- },
29
- });
30
- });
31
-
32
- it(`should remove ensure-symlink target from project.json`, async () => {
33
- await update(tree);
34
-
35
- getProjects(tree).forEach((project) => {
36
- expect(project.targets['ensure-symlink']).toBeUndefined();
37
- expect(project.targets['bundle-android'].dependsOn).toEqual([]);
38
- });
39
- });
40
- });
@@ -1,2 +0,0 @@
1
- import { GeneratorCallback, Tree } from '@nx/devkit';
2
- export declare function ensureDependencies(tree: Tree): GeneratorCallback;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureDependencies = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- const versions_1 = require("@nx/react/src/utils/versions");
6
- const versions_2 = require("./versions");
7
- function ensureDependencies(tree) {
8
- const isPnpm = (0, devkit_1.detectPackageManager)(tree.root) === 'pnpm';
9
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
10
- '@types/node': versions_2.typesNodeVersion,
11
- '@types/react': versions_2.typesReactVersion,
12
- '@react-native/babel-preset': versions_2.reactNativeBabelPresetVersion,
13
- '@react-native/metro-config': versions_2.reactNativeMetroConfigVersion,
14
- '@testing-library/react-native': versions_2.testingLibraryReactNativeVersion,
15
- '@testing-library/jest-native': versions_2.testingLibraryJestNativeVersion,
16
- '@react-native-community/cli-platform-android': versions_2.reactNativeCommunityCliPlatformAndroidVersion,
17
- 'jest-react-native': versions_2.jestReactNativeVersion,
18
- 'react-test-renderer': versions_2.reactTestRendererVersion,
19
- 'react-native-svg-transformer': versions_2.reactNativeSvgTransformerVersion,
20
- 'react-native-svg': versions_2.reactNativeSvgVersion,
21
- '@babel/preset-react': versions_1.babelPresetReactVersion,
22
- '@babel/core': versions_1.babelCoreVersion,
23
- ...(isPnpm
24
- ? {
25
- '@babel/runtime': versions_2.babelRuntimeVersion, // @babel/runtime is used by react-native-svg
26
- }
27
- : {}),
28
- });
29
- }
30
- exports.ensureDependencies = ensureDependencies;