@nrwl/react-native 13.8.1 → 13.8.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.
Files changed (66) hide show
  1. package/executors.json +10 -0
  2. package/generators.json +36 -0
  3. package/migrations.json +41 -0
  4. package/package.json +10 -9
  5. package/src/executors/build-android/build-android.impl.js +8 -6
  6. package/src/executors/build-android/build-android.impl.js.map +1 -1
  7. package/src/executors/build-android/build-android.impl.ts +8 -10
  8. package/src/executors/storybook/compat.d.ts +2 -0
  9. package/src/executors/storybook/compat.js +6 -0
  10. package/src/executors/storybook/compat.js.map +1 -0
  11. package/src/executors/storybook/schema.d.ts +7 -0
  12. package/src/executors/storybook/schema.json +28 -0
  13. package/src/executors/storybook/storybook.impl.d.ts +5 -0
  14. package/src/executors/storybook/storybook.impl.js +63 -0
  15. package/src/executors/storybook/storybook.impl.js.map +1 -0
  16. package/src/executors/storybook/storybook.impl.ts +92 -0
  17. package/src/generators/application/files/app/android/app/build.gradle.template +1 -1
  18. package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +29 -0
  19. package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +1 -0
  20. package/src/generators/application/files/app/android/build.gradle.template +7 -3
  21. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  22. package/src/generators/application/files/app/android/gradle.properties +1 -1
  23. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +29 -72
  24. package/src/generators/application/files/app/metro.config.js.template +1 -0
  25. package/src/generators/application/files/app/package.json.template +2 -1
  26. package/src/generators/application/files/app/src/app/App.tsx.template +1 -1
  27. package/src/generators/component-story/component-story.d.ts +8 -0
  28. package/src/generators/component-story/component-story.js +95 -0
  29. package/src/generators/component-story/component-story.js.map +1 -0
  30. package/src/generators/component-story/component-story.spec.ts +445 -0
  31. package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +25 -0
  32. package/src/generators/component-story/schema.d.ts +4 -0
  33. package/src/generators/component-story/schema.json +25 -0
  34. package/src/generators/init/init.js +1 -1
  35. package/src/generators/init/init.js.map +1 -1
  36. package/src/generators/stories/schema.d.ts +3 -0
  37. package/src/generators/stories/schema.json +18 -0
  38. package/src/generators/stories/stories-app.spec.ts +66 -0
  39. package/src/generators/stories/stories-lib.spec.ts +86 -0
  40. package/src/generators/stories/stories.d.ts +7 -0
  41. package/src/generators/stories/stories.js +66 -0
  42. package/src/generators/stories/stories.js.map +1 -0
  43. package/src/generators/storybook-configuration/configuration.d.ts +5 -0
  44. package/src/generators/storybook-configuration/configuration.js +52 -0
  45. package/src/generators/storybook-configuration/configuration.js.map +1 -0
  46. package/src/generators/storybook-configuration/configuration.spec.ts +142 -0
  47. package/src/generators/storybook-configuration/files/app/storybook.ts.template +9 -0
  48. package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +114 -0
  49. package/src/generators/storybook-configuration/files/root/story-loader.js.template +13 -0
  50. package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +6 -0
  51. package/src/generators/storybook-configuration/lib/create-storybook-files.js +46 -0
  52. package/src/generators/storybook-configuration/lib/create-storybook-files.js.map +1 -0
  53. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +7 -0
  54. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +30 -0
  55. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js.map +1 -0
  56. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +65 -0
  57. package/src/generators/storybook-configuration/schema.d.ts +9 -0
  58. package/src/generators/storybook-configuration/schema.json +38 -0
  59. package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js +3 -8
  60. package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js.map +1 -1
  61. package/src/utils/format-file.d.ts +1 -0
  62. package/src/utils/format-file.js +17 -0
  63. package/src/utils/format-file.js.map +1 -0
  64. package/src/utils/versions.d.ts +9 -8
  65. package/src/utils/versions.js +11 -10
  66. package/src/utils/versions.js.map +1 -1
package/executors.json CHANGED
@@ -34,6 +34,11 @@
34
34
  "implementation": "./src/executors/ensure-symlink/ensure-symlink.impl",
35
35
  "schema": "./src/executors/ensure-symlink//schema.json",
36
36
  "description": "Ensure workspace node_modules is symlink under app's node_modules folder."
37
+ },
38
+ "storybook": {
39
+ "implementation": "./src/executors/storybook/storybook.impl",
40
+ "schema": "./src/executors/storybook/schema.json",
41
+ "description": "Serve React Native Storybook"
37
42
  }
38
43
  },
39
44
  "builders": {
@@ -71,6 +76,11 @@
71
76
  "implementation": "./src/executors/ensure-symlink/compat",
72
77
  "schema": "./src/executors/ensure-symlink//schema.json",
73
78
  "description": "Ensure workspace node_modules is symlink under app's node_modules folder."
79
+ },
80
+ "storybook": {
81
+ "implementation": "./src/executors/storybook/compat",
82
+ "schema": "./src/executors/storybook/schema.json",
83
+ "description": "Serve React Native Storybook"
74
84
  }
75
85
  }
76
86
  }
package/generators.json CHANGED
@@ -28,6 +28,24 @@
28
28
  "schema": "./src/generators/component/schema.json",
29
29
  "description": "Create a React Native component",
30
30
  "aliases": ["c"]
31
+ },
32
+ "storybook-configuration": {
33
+ "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationSchematic",
34
+ "schema": "./src/generators/storybook-configuration/schema.json",
35
+ "description": "Set up storybook for a react-native app or library",
36
+ "hidden": false
37
+ },
38
+ "component-story": {
39
+ "factory": "./src/generators/component-story/component-story#componentStorySchematic",
40
+ "schema": "./src/generators/component-story/schema.json",
41
+ "description": "Generate storybook story for a react-native component",
42
+ "hidden": false
43
+ },
44
+ "stories": {
45
+ "factory": "./src/generators/stories/stories#storiesSchematic",
46
+ "schema": "./src/generators/stories/schema.json",
47
+ "description": "Create stories for all components declared in an app or library",
48
+ "hidden": false
31
49
  }
32
50
  },
33
51
  "generators": {
@@ -56,6 +74,24 @@
56
74
  "schema": "./src/generators/component/schema.json",
57
75
  "description": "Create a React Native component",
58
76
  "aliases": ["c"]
77
+ },
78
+ "storybook-configuration": {
79
+ "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationGenerator",
80
+ "schema": "./src/generators/storybook-configuration/schema.json",
81
+ "description": "Set up storybook for a react-native app or library",
82
+ "hidden": false
83
+ },
84
+ "component-story": {
85
+ "factory": "./src/generators/component-story/component-story#componentStoryGenerator",
86
+ "schema": "./src/generators/component-story/schema.json",
87
+ "description": "Generate storybook story for a react-native component",
88
+ "hidden": false
89
+ },
90
+ "stories": {
91
+ "factory": "./src/generators/stories/stories#storiesGenerator",
92
+ "schema": "./src/generators/stories/schema.json",
93
+ "description": "Create stories/specs for all components declared in an app or library",
94
+ "hidden": false
59
95
  }
60
96
  }
61
97
  }
package/migrations.json CHANGED
@@ -333,6 +333,47 @@
333
333
  "addToPackageJson": "devDependencies"
334
334
  }
335
335
  }
336
+ },
337
+ "13.8.2": {
338
+ "version": "13.8.2-beta.0",
339
+ "packages": {
340
+ "react-native": {
341
+ "version": "0.67.2",
342
+ "alwaysAddToPackageJson": false
343
+ },
344
+ "@types/react-native": {
345
+ "version": "0.66.15",
346
+ "alwaysAddToPackageJson": false
347
+ },
348
+ "@react-native-community/cli": {
349
+ "version": "7.0.1",
350
+ "alwaysAddToPackageJson": false
351
+ },
352
+ "@react-native-community/cli-platform-android": {
353
+ "version": "7.0.1",
354
+ "alwaysAddToPackageJson": false
355
+ },
356
+ "@react-native-community/cli-platform-ios": {
357
+ "version": "7.0.1",
358
+ "alwaysAddToPackageJson": false
359
+ },
360
+ "metro": {
361
+ "version": "0.67.0",
362
+ "alwaysAddToPackageJson": false
363
+ },
364
+ "metro-resolver": {
365
+ "version": "0.67.0",
366
+ "alwaysAddToPackageJson": false
367
+ },
368
+ "metro-react-native-babel-preset": {
369
+ "version": "0.67.0",
370
+ "alwaysAddToPackageJson": false
371
+ },
372
+ "@babel/runtime": {
373
+ "version": "7.17.2",
374
+ "alwaysAddToPackageJson": false
375
+ }
376
+ }
336
377
  }
337
378
  }
338
379
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/react-native",
3
- "version": "13.8.1",
3
+ "version": "13.8.2",
4
4
  "description": "React Native Plugin for Nx",
5
5
  "keywords": [
6
6
  "Monorepo",
@@ -24,22 +24,23 @@
24
24
  "main": "index.js",
25
25
  "types": "index.d.ts",
26
26
  "dependencies": {
27
- "@nrwl/detox": "13.8.1",
28
- "@nrwl/devkit": "13.8.1",
29
- "@nrwl/jest": "13.8.1",
30
- "@nrwl/linter": "13.8.1",
31
- "@nrwl/react": "13.8.1",
32
- "@nrwl/workspace": "13.8.1",
27
+ "@nrwl/detox": "13.8.2",
28
+ "@nrwl/devkit": "13.8.2",
29
+ "@nrwl/jest": "13.8.2",
30
+ "@nrwl/linter": "13.8.2",
31
+ "@nrwl/storybook": "13.8.2",
32
+ "@nrwl/react": "13.8.2",
33
+ "@nrwl/workspace": "13.8.2",
33
34
  "chalk": "^4.1.0",
34
35
  "enhanced-resolve": "^5.8.3",
35
36
  "fs-extra": "^9.1.0",
36
37
  "ignore": "^5.0.4",
37
- "metro-resolver": "^0.66.2",
38
+ "metro-resolver": "^0.67.0",
38
39
  "node-fetch": "^2.6.7",
39
40
  "tsconfig-paths": "^3.9.0"
40
41
  },
41
42
  "peerDependencies": {
42
- "react-native": "^0.66.4"
43
+ "react-native": "^0.67.2"
43
44
  },
44
45
  "builders": "./executors.json",
45
46
  "ng-update": {
@@ -48,15 +48,17 @@ function runCliBuild(workspaceRoot, projectRoot, options) {
48
48
  });
49
49
  }
50
50
  function getGradleCommand(options) {
51
- if (options.apk && options.debug) {
52
- return 'assembleDebug';
53
- }
54
51
  if (options.apk) {
52
+ if (options.debug) {
53
+ return 'assembleDebug';
54
+ }
55
55
  return 'assembleRelease';
56
56
  }
57
- if (options.debug) {
58
- return 'bundleDebug';
57
+ else {
58
+ if (options.debug) {
59
+ return 'bundleDebug';
60
+ }
61
+ return 'bundleRelease';
59
62
  }
60
- return 'bundleRelease';
61
63
  }
62
64
  //# sourceMappingURL=build-android.impl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-android.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/build-android/build-android.impl.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,yFAAmF;AACnF,iDAAoD;AACpD,2BAA+B;AAM/B,IAAI,YAA0B,CAAC;AAE/B,SAA+B,oBAAoB,CACjD,OAAgC,EAChC,OAAwB;;QAExB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACzE,IAAA,sDAAwB,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACpD,IAAA,cAAS,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;QAC1D,IAAA,cAAS,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC;QAE9D,IAAI;YACF,2BAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA,CAAC;YACtD,iCAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA,CAAC;SACzB;gBAAS;YACR,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,IAAI,EAAE,CAAC;aACrB;SACF;IACH,CAAC;CAAA;AAjBD,uCAiBC;AAED,SAAS,WAAW,CAClB,aAAqB,EACrB,WAAmB,EACnB,OAAgC;IAEhC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEhD,YAAY,GAAG,IAAA,qBAAK,EAClB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAC1D,CAAC,aAAa,CAAC,EACf;YACE,GAAG,EAAE,IAAA,WAAI,EAAC,aAAa,EAAE,WAAW,EAAE,SAAS,CAAC;YAChD,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SACjB,CACF,CAAC;QAEF,2DAA2D;QAC3D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAEjD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC/B,IAAI,IAAI,KAAK,CAAC,EAAE;gBACd,OAAO,CAAC,IAAI,CAAC,CAAC;aACf;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,CAAC;aACd;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgC;IACxD,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE;QAChC,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,OAAO,CAAC,GAAG,EAAE;QACf,OAAO,iBAAiB,CAAC;KAC1B;IAED,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"build-android.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/build-android/build-android.impl.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,yFAAmF;AACnF,iDAAoD;AACpD,2BAA+B;AAM/B,IAA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AC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QAEjD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC/B,IAAI,IAAI,KAAK,CAAC,EAAE;gBACd,OAAO,CAAC,IAAI,CAAC,CAAC;aACf;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,CAAC;aACd;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgC;IACxD,IAAI,OAAO,CAAC,GAAG,EAAE;QACf,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,eAAe,CAAC;SACxB;QACD,OAAO,iBAAiB,CAAC;KAC1B;SAAM;QACL,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,aAAa,CAAC;SACtB;QACD,OAAO,eAAe,CAAC;KACxB;AACH,CAAC"}
@@ -64,17 +64,15 @@ function runCliBuild(
64
64
  }
65
65
 
66
66
  function getGradleCommand(options: ReactNativeBuildOptions) {
67
- if (options.apk && options.debug) {
68
- return 'assembleDebug';
69
- }
70
-
71
67
  if (options.apk) {
68
+ if (options.debug) {
69
+ return 'assembleDebug';
70
+ }
72
71
  return 'assembleRelease';
72
+ } else {
73
+ if (options.debug) {
74
+ return 'bundleDebug';
75
+ }
76
+ return 'bundleRelease';
73
77
  }
74
-
75
- if (options.debug) {
76
- return 'bundleDebug';
77
- }
78
-
79
- return 'bundleRelease';
80
78
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const storybook_impl_1 = require("./storybook.impl");
5
+ exports.default = (0, devkit_1.convertNxExecutor)(storybook_impl_1.default);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/storybook/compat.ts"],"names":[],"mappings":";;AAAA,yCAAiD;AAEjD,qDAAiD;AAEjD,kBAAe,IAAA,0BAAiB,EAAC,wBAAiB,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ // options from https://github.com/elderfo/react-native-storybook-loader#options
2
+ export interface ReactNativeStorybookOptions {
3
+ searchDir: string;
4
+ outputFile: string;
5
+ pattern: string;
6
+ silent: boolean;
7
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "title": "React Native Storybook Load Stories",
3
+ "cli": "nx",
4
+ "description": "Load stories for react native",
5
+ "type": "object",
6
+ "properties": {
7
+ "searchDir": {
8
+ "type": "string",
9
+ "description": "The directory or directories, relative to the project root, to search for files in."
10
+ },
11
+ "outputFile": {
12
+ "type": "string",
13
+ "description": "The output file that will be written. It is relative to the project directory.",
14
+ "default": "./.storybook/story-loader.js"
15
+ },
16
+ "pattern": {
17
+ "type": "string",
18
+ "description": "The pattern of files to look at. It can be a specific file, or any valid glob. Note: if using the CLI, globs with **/*... must be escaped with quotes",
19
+ "default": "**/*.stories.@(js|jsx|ts|tsx|md)"
20
+ },
21
+ "silent": {
22
+ "type": "boolean",
23
+ "description": "Silences output.",
24
+ "default": false
25
+ }
26
+ },
27
+ "required": ["searchDir", "outputFile", "pattern"]
28
+ }
@@ -0,0 +1,5 @@
1
+ import { ExecutorContext } from '@nrwl/devkit';
2
+ import { ReactNativeStorybookOptions } from './schema';
3
+ export default function reactNatievStorybookExecutor(options: ReactNativeStorybookOptions, context: ExecutorContext): AsyncGenerator<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const path_1 = require("path");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ const chalk = require("chalk");
7
+ const child_process_1 = require("child_process");
8
+ const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
9
+ let childProcess;
10
+ function reactNatievStorybookExecutor(options, context) {
11
+ return (0, tslib_1.__asyncGenerator)(this, arguments, function* reactNatievStorybookExecutor_1() {
12
+ const projectRoot = context.workspace.projects[context.projectName].root;
13
+ 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).`);
14
+ // add storybook addons to app's package.json
15
+ (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, yield (0, tslib_1.__await)((0, sync_deps_impl_1.syncDeps)(context.projectName, projectRoot, context.root, '@storybook/addon-ondevice-actions,@storybook/addon-ondevice-backgrounds,@storybook/addon-ondevice-controls,@storybook/addon-ondevice-notes')));
16
+ try {
17
+ yield (0, tslib_1.__await)(runCliStorybook(context.root, projectRoot, options));
18
+ yield yield (0, tslib_1.__await)({ success: true });
19
+ }
20
+ finally {
21
+ if (childProcess) {
22
+ childProcess.kill();
23
+ }
24
+ }
25
+ });
26
+ }
27
+ exports.default = reactNatievStorybookExecutor;
28
+ function runCliStorybook(workspaceRoot, projectRoot, options) {
29
+ return new Promise((resolve, reject) => {
30
+ childProcess = (0, child_process_1.fork)((0, path_1.join)(workspaceRoot, './node_modules/react-native-storybook-loader/out/rnstl-cli.js'), createStorybookOptions(options), {
31
+ cwd: workspaceRoot,
32
+ });
33
+ // Ensure the child process is killed when the parent exits
34
+ process.on('exit', () => childProcess.kill());
35
+ process.on('SIGTERM', () => childProcess.kill());
36
+ childProcess.on('error', (err) => {
37
+ reject(err);
38
+ });
39
+ childProcess.on('exit', (code) => {
40
+ if (code === 0) {
41
+ resolve(code);
42
+ }
43
+ else {
44
+ reject(code);
45
+ }
46
+ });
47
+ });
48
+ }
49
+ function createStorybookOptions(options) {
50
+ return Object.keys(options).reduce((acc, k) => {
51
+ const v = options[k];
52
+ if (typeof v === 'boolean') {
53
+ if (v === true) {
54
+ acc.push(`--${k}`);
55
+ }
56
+ }
57
+ else {
58
+ acc.push(`--${k}`, options[k]);
59
+ }
60
+ return acc;
61
+ }, []);
62
+ }
63
+ //# sourceMappingURL=storybook.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,yCAAuD;AACvD,+BAA+B;AAG/B,iDAAmD;AACnD,gEAGqC;AAErC,IAAI,YAA0B,CAAC;AAE/B,SAA+B,4BAA4B,CACzD,OAAoC,EACpC,OAAwB;;QAExB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACzE,eAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAChB,MAAM,CACP,8IAA8I,CAChJ,CAAC;QAEF,6CAA6C;QAC7C,IAAA,6CAA4B,EAC1B,OAAO,CAAC,WAAW,EACnB,2BAAM,IAAA,yBAAQ,EACZ,OAAO,CAAC,WAAW,EACnB,WAAW,EACX,OAAO,CAAC,IAAI,EACZ,4IAA4I,CAC7I,CAAA,CACF,CAAC;QAEF,IAAI;YACF,2BAAM,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA,CAAC;YAC1D,iCAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA,CAAC;SACzB;gBAAS;YACR,IAAI,YAAY,EAAE;gBAChB,YAAY,CAAC,IAAI,EAAE,CAAC;aACrB;SACF;IACH,CAAC;CAAA;AA9BD,+CA8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IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { join } from 'path';
2
+ import { ExecutorContext, logger } from '@nrwl/devkit';
3
+ import * as chalk from 'chalk';
4
+
5
+ import { ReactNativeStorybookOptions } from './schema';
6
+ import { ChildProcess, fork } from 'child_process';
7
+ import {
8
+ displayNewlyAddedDepsMessage,
9
+ syncDeps,
10
+ } from '../sync-deps/sync-deps.impl';
11
+
12
+ let childProcess: ChildProcess;
13
+
14
+ export default async function* reactNatievStorybookExecutor(
15
+ options: ReactNativeStorybookOptions,
16
+ context: ExecutorContext
17
+ ): AsyncGenerator<{ success: boolean }> {
18
+ const projectRoot = context.workspace.projects[context.projectName].root;
19
+ logger.info(
20
+ `${chalk.bold.cyan(
21
+ 'info'
22
+ )} To see your Storybook stories on the device, you should start your mobile app for the <platform> of your choice (typically ios or android).`
23
+ );
24
+
25
+ // add storybook addons to app's package.json
26
+ displayNewlyAddedDepsMessage(
27
+ context.projectName,
28
+ await syncDeps(
29
+ context.projectName,
30
+ projectRoot,
31
+ context.root,
32
+ '@storybook/addon-ondevice-actions,@storybook/addon-ondevice-backgrounds,@storybook/addon-ondevice-controls,@storybook/addon-ondevice-notes'
33
+ )
34
+ );
35
+
36
+ try {
37
+ await runCliStorybook(context.root, projectRoot, options);
38
+ yield { success: true };
39
+ } finally {
40
+ if (childProcess) {
41
+ childProcess.kill();
42
+ }
43
+ }
44
+ }
45
+
46
+ function runCliStorybook(
47
+ workspaceRoot: string,
48
+ projectRoot: string,
49
+ options: ReactNativeStorybookOptions
50
+ ) {
51
+ return new Promise((resolve, reject) => {
52
+ childProcess = fork(
53
+ join(
54
+ workspaceRoot,
55
+ './node_modules/react-native-storybook-loader/out/rnstl-cli.js'
56
+ ),
57
+ createStorybookOptions(options),
58
+ {
59
+ cwd: workspaceRoot,
60
+ }
61
+ );
62
+
63
+ // Ensure the child process is killed when the parent exits
64
+ process.on('exit', () => childProcess.kill());
65
+ process.on('SIGTERM', () => childProcess.kill());
66
+
67
+ childProcess.on('error', (err) => {
68
+ reject(err);
69
+ });
70
+ childProcess.on('exit', (code) => {
71
+ if (code === 0) {
72
+ resolve(code);
73
+ } else {
74
+ reject(code);
75
+ }
76
+ });
77
+ });
78
+ }
79
+
80
+ function createStorybookOptions(options) {
81
+ return Object.keys(options).reduce((acc, k) => {
82
+ const v = options[k];
83
+ if (typeof v === 'boolean') {
84
+ if (v === true) {
85
+ acc.push(`--${k}`);
86
+ }
87
+ } else {
88
+ acc.push(`--${k}`, options[k]);
89
+ }
90
+ return acc;
91
+ }, []);
92
+ }
@@ -116,7 +116,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
116
116
  /**
117
117
  * Whether to enable the Hermes VM.
118
118
  *
119
- * This should be set on project.ext.react and mirrored here. If it is not set
119
+ * This should be set on project.ext.react and that value will be read here. If it is not set
120
120
  * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
121
121
  * and the benefits of using Hermes will therefore be sharply reduced.
122
122
  */
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Copyright (C) 2014 The Android Open Source Project
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ -->
13
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
14
+ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
15
+ android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
16
+ android:insetTop="@dimen/abc_edit_text_inset_top_material"
17
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
18
+ <selector>
19
+ <!--
20
+ This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
21
+ The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
22
+ NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
23
+ <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
24
+ For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
25
+ -->
26
+ <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
27
+ <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
28
+ </selector>
29
+ </inset>
@@ -2,6 +2,7 @@
2
2
  <!-- Base application theme. -->
3
3
  <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
4
4
  <!-- Customize your theme here. -->
5
+ <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
5
6
  </style>
6
7
 
7
8
  <style name="Theme.App.SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
@@ -21,8 +21,6 @@ buildscript {
21
21
 
22
22
  allprojects {
23
23
  repositories {
24
- mavenCentral()
25
- mavenLocal()
26
24
  maven {
27
25
  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
28
26
  url("$rootDir/../node_modules/react-native/android")
@@ -31,7 +29,13 @@ allprojects {
31
29
  // Android JSC is installed from npm
32
30
  url("$rootDir/../node_modules/jsc-android/dist")
33
31
  }
34
-
32
+ mavenCentral {
33
+ // We don't want to fetch react-native from Maven Central as there are
34
+ // older versions over there.
35
+ content {
36
+ excludeGroup "com.facebook.react"
37
+ }
38
+ }
35
39
  google()
36
40
  maven { url 'https://www.jitpack.io' }
37
41
 
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -9,7 +9,7 @@
9
9
 
10
10
  # Specifies the JVM arguments used for the daemon process.
11
11
  # The setting is particularly useful for tweaking memory settings.
12
- # Default value: -Xmx10248m -XX:MaxPermSize=256m
12
+ # Default value: -Xmx1024m -XX:MaxPermSize=256m
13
13
  # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
14
 
15
15
  # When configured, Gradle will run in incubating parallel mode.