@nrwl/react-native 13.7.3 → 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.
- package/executors.json +10 -0
- package/generators.json +36 -0
- package/migrations.json +41 -0
- package/package.json +10 -9
- package/plugins/metro-resolver.js +4 -14
- package/plugins/metro-resolver.js.map +1 -1
- package/src/executors/build-android/build-android.impl.js +16 -1
- package/src/executors/build-android/build-android.impl.js.map +1 -1
- package/src/executors/build-android/build-android.impl.ts +17 -1
- package/src/executors/build-android/schema.d.ts +1 -0
- package/src/executors/build-android/schema.json +4 -0
- package/src/executors/storybook/compat.d.ts +2 -0
- package/src/executors/storybook/compat.js +6 -0
- package/src/executors/storybook/compat.js.map +1 -0
- package/src/executors/storybook/schema.d.ts +7 -0
- package/src/executors/storybook/schema.json +28 -0
- package/src/executors/storybook/storybook.impl.d.ts +5 -0
- package/src/executors/storybook/storybook.impl.js +63 -0
- package/src/executors/storybook/storybook.impl.js.map +1 -0
- package/src/executors/storybook/storybook.impl.ts +92 -0
- package/src/generators/application/files/app/android/app/build.gradle.template +1 -1
- package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +29 -0
- package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +1 -0
- package/src/generators/application/files/app/android/build.gradle.template +7 -3
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/src/generators/application/files/app/android/gradle.properties +1 -1
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +29 -72
- package/src/generators/application/files/app/metro.config.js.template +1 -0
- package/src/generators/application/files/app/package.json.template +2 -1
- package/src/generators/application/files/app/src/app/App.tsx.template +1 -1
- package/src/generators/component-story/component-story.d.ts +8 -0
- package/src/generators/component-story/component-story.js +95 -0
- package/src/generators/component-story/component-story.js.map +1 -0
- package/src/generators/component-story/component-story.spec.ts +445 -0
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +25 -0
- package/src/generators/component-story/schema.d.ts +4 -0
- package/src/generators/component-story/schema.json +25 -0
- package/src/generators/init/init.js +1 -1
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/stories/schema.d.ts +3 -0
- package/src/generators/stories/schema.json +18 -0
- package/src/generators/stories/stories-app.spec.ts +66 -0
- package/src/generators/stories/stories-lib.spec.ts +86 -0
- package/src/generators/stories/stories.d.ts +7 -0
- package/src/generators/stories/stories.js +66 -0
- package/src/generators/stories/stories.js.map +1 -0
- package/src/generators/storybook-configuration/configuration.d.ts +5 -0
- package/src/generators/storybook-configuration/configuration.js +52 -0
- package/src/generators/storybook-configuration/configuration.js.map +1 -0
- package/src/generators/storybook-configuration/configuration.spec.ts +142 -0
- package/src/generators/storybook-configuration/files/app/storybook.ts.template +9 -0
- package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +114 -0
- package/src/generators/storybook-configuration/files/root/story-loader.js.template +13 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +6 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.js +46 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.js.map +1 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +7 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +30 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js.map +1 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +65 -0
- package/src/generators/storybook-configuration/schema.d.ts +9 -0
- package/src/generators/storybook-configuration/schema.json +38 -0
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js +3 -8
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js.map +1 -1
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +17 -0
- package/src/utils/format-file.js.map +1 -0
- package/src/utils/versions.d.ts +9 -8
- package/src/utils/versions.js +11 -10
- 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.
|
|
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.
|
|
28
|
-
"@nrwl/devkit": "13.
|
|
29
|
-
"@nrwl/jest": "13.
|
|
30
|
-
"@nrwl/linter": "13.
|
|
31
|
-
"@nrwl/
|
|
32
|
-
"@nrwl/
|
|
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.
|
|
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.
|
|
43
|
+
"react-native": "^0.67.2"
|
|
43
44
|
},
|
|
44
45
|
"builders": "./executors.json",
|
|
45
46
|
"ng-update": {
|
|
@@ -32,7 +32,7 @@ function getResolveRequest(extensions) {
|
|
|
32
32
|
return resolvedPath;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
return tsconfigPathsResolver(extensions, realModuleName, moduleName);
|
|
35
|
+
return tsconfigPathsResolver(context, extensions, realModuleName, moduleName, platform);
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
exports.getResolveRequest = getResolveRequest;
|
|
@@ -74,22 +74,12 @@ function pnpmResolver(extensions, context, realModuleName, moduleName) {
|
|
|
74
74
|
* This function try to resolve files that are specified in tsconfig's paths
|
|
75
75
|
* @returns path if resolved, else undefined
|
|
76
76
|
*/
|
|
77
|
-
function tsconfigPathsResolver(extensions, realModuleName, moduleName) {
|
|
77
|
+
function tsconfigPathsResolver(context, extensions, realModuleName, moduleName, platform) {
|
|
78
78
|
const DEBUG = process.env.NX_REACT_NATIVE_DEBUG === 'true';
|
|
79
79
|
const matcher = getMatcher();
|
|
80
|
-
|
|
81
|
-
// find out the file extension
|
|
82
|
-
const matchExtension = extensions.find((extension) => {
|
|
83
|
-
match = matcher(realModuleName, undefined, undefined, ['.' + extension]);
|
|
84
|
-
return !!match;
|
|
85
|
-
});
|
|
80
|
+
const match = matcher(realModuleName, undefined, undefined, extensions.map((ext) => `.${ext}`));
|
|
86
81
|
if (match) {
|
|
87
|
-
return
|
|
88
|
-
type: 'sourceFile',
|
|
89
|
-
filePath: !matchExtension || match.endsWith(`.${matchExtension}`)
|
|
90
|
-
? match
|
|
91
|
-
: `${match}.${matchExtension}`,
|
|
92
|
-
};
|
|
82
|
+
return metroResolver.resolve(context, match, platform);
|
|
93
83
|
}
|
|
94
84
|
else {
|
|
95
85
|
if (DEBUG) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metro-resolver.js","sourceRoot":"","sources":["../../../../packages/react-native/plugins/metro-resolver.ts"],"names":[],"mappings":";;;;AAAA,gDAAgD;AAEhD,mDAA6D;AAC7D,+BAA+B;AAC/B,yCAAoD;AACpD,uDAA0E;AAC1E,+BAAqC;AACrC,yBAAyB;AACzB,2DAA2D;AAE3D;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,UAAoB;IACpD,OAAO,UACL,QAAa,EACb,cAAsB,EACtB,QAAuB,EACvB,UAAkB;QAElB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,CAAC;QAE3D,IAAI,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC,CAAC;QAEpE,MAAM,EAAE,cAAc,KAAiB,QAAQ,EAApB,OAAO,uBAAK,QAAQ,EAAzC,kBAA8B,CAAW,CAAC;QAEhD,IAAI,YAAY,GAAG,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QACvE,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC;SACrB;QAED,IAAI,IAAA,6BAAoB,EAAC,sBAAW,CAAC,KAAK,MAAM,EAAE;YAChD,YAAY,GAAG,YAAY,CACzB,UAAU,EACV,OAAO,EACP,cAAc,EACd,UAAU,CACX,CAAC;YACF,IAAI,YAAY,EAAE;gBAChB,OAAO,YAAY,CAAC;aACrB;SACF;QAED,OAAO,qBAAqB,
|
|
1
|
+
{"version":3,"file":"metro-resolver.js","sourceRoot":"","sources":["../../../../packages/react-native/plugins/metro-resolver.ts"],"names":[],"mappings":";;;;AAAA,gDAAgD;AAEhD,mDAA6D;AAC7D,+BAA+B;AAC/B,yCAAoD;AACpD,uDAA0E;AAC1E,+BAAqC;AACrC,yBAAyB;AACzB,2DAA2D;AAE3D;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,UAAoB;IACpD,OAAO,UACL,QAAa,EACb,cAAsB,EACtB,QAAuB,EACvB,UAAkB;QAElB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,CAAC;QAE3D,IAAI,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC,CAAC;QAEpE,MAAM,EAAE,cAAc,KAAiB,QAAQ,EAApB,OAAO,uBAAK,QAAQ,EAAzC,kBAA8B,CAAW,CAAC;QAEhD,IAAI,YAAY,GAAG,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QACvE,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC;SACrB;QAED,IAAI,IAAA,6BAAoB,EAAC,sBAAW,CAAC,KAAK,MAAM,EAAE;YAChD,YAAY,GAAG,YAAY,CACzB,UAAU,EACV,OAAO,EACP,cAAc,EACd,UAAU,CACX,CAAC;YACF,IAAI,YAAY,EAAE;gBAChB,OAAO,YAAY,CAAC;aACrB;SACF;QAED,OAAO,qBAAqB,CAC1B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GAAG,CACT,KAAK,CAAC,IAAI,CAAC,4BAA4B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CACtE,CAAC;gBACF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,IAAI,CACR,qCAAqC,KAAK,CAAC,IAAI,CAC7C,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAC/B,EAAE,CACJ,CACF,CAAC;aACH;YACD,OAAO,GAAG,IAAA,gCAAe,EAAC,eAAe,EAAE,KAAK,CAAC,CAAC;SACnD;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,IAAI,QAAQ,CAAC;AACb,SAAS,eAAe,CAAC,WAAmB,EAAE,UAAoB;IAChE,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,UAAU,GAAG,IAAI,wCAAqB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACvD,QAAQ,GAAG,kCAAe,CAAC,cAAc,CAAC;YACxC,UAAU;YACV,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,GAAG,SAAS,CAAC;YAC1D,sBAAsB,EAAE,IAAI;YAC5B,OAAO,EAAE,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,cAAc,CAAC,EAAE,cAAc,CAAC;SAC7D,CAAC,CAAC;KACJ;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -26,7 +26,8 @@ function buildAndroidExecutor(options, context) {
|
|
|
26
26
|
exports.default = buildAndroidExecutor;
|
|
27
27
|
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
28
28
|
return new Promise((resolve, reject) => {
|
|
29
|
-
|
|
29
|
+
const gradleCommand = getGradleCommand(options);
|
|
30
|
+
childProcess = (0, child_process_1.spawn)(process.platform === 'win32' ? 'gradlew.bat' : './gradlew', [gradleCommand], {
|
|
30
31
|
cwd: (0, path_1.join)(workspaceRoot, projectRoot, 'android'),
|
|
31
32
|
stdio: [0, 1, 2],
|
|
32
33
|
});
|
|
@@ -46,4 +47,18 @@ function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
|
46
47
|
});
|
|
47
48
|
});
|
|
48
49
|
}
|
|
50
|
+
function getGradleCommand(options) {
|
|
51
|
+
if (options.apk) {
|
|
52
|
+
if (options.debug) {
|
|
53
|
+
return 'assembleDebug';
|
|
54
|
+
}
|
|
55
|
+
return 'assembleRelease';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (options.debug) {
|
|
59
|
+
return 'bundleDebug';
|
|
60
|
+
}
|
|
61
|
+
return 'bundleRelease';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
49
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,YAAY,GAAG,IAAA,qBAAK,EAClB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAC1D,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,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,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AC,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"}
|
|
@@ -35,9 +35,11 @@ function runCliBuild(
|
|
|
35
35
|
options: ReactNativeBuildOptions
|
|
36
36
|
) {
|
|
37
37
|
return new Promise((resolve, reject) => {
|
|
38
|
+
const gradleCommand = getGradleCommand(options);
|
|
39
|
+
|
|
38
40
|
childProcess = spawn(
|
|
39
41
|
process.platform === 'win32' ? 'gradlew.bat' : './gradlew',
|
|
40
|
-
[
|
|
42
|
+
[gradleCommand],
|
|
41
43
|
{
|
|
42
44
|
cwd: join(workspaceRoot, projectRoot, 'android'),
|
|
43
45
|
stdio: [0, 1, 2],
|
|
@@ -60,3 +62,17 @@ function runCliBuild(
|
|
|
60
62
|
});
|
|
61
63
|
});
|
|
62
64
|
}
|
|
65
|
+
|
|
66
|
+
function getGradleCommand(options: ReactNativeBuildOptions) {
|
|
67
|
+
if (options.apk) {
|
|
68
|
+
if (options.debug) {
|
|
69
|
+
return 'assembleDebug';
|
|
70
|
+
}
|
|
71
|
+
return 'assembleRelease';
|
|
72
|
+
} else {
|
|
73
|
+
if (options.debug) {
|
|
74
|
+
return 'bundleDebug';
|
|
75
|
+
}
|
|
76
|
+
return 'bundleRelease';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -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,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,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;QAE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AC,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5C,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,KAAK,IAAI,EAAE;gBACd,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACpB;SACF;aAAM;YACL,GAAG,CAAC,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
|
|
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
|
|
package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
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: -
|
|
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.
|