@nx/react-native 17.3.0-beta.4 → 17.3.0-beta.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.
- package/package.json +10 -10
- package/plugins/plugin.d.ts +1 -0
- package/plugins/plugin.js +12 -3
- package/src/generators/application/application.js +5 -0
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/init/init.js +4 -3
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +6 -0
- package/src/generators/stories/stories.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.0-beta.6",
|
|
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": [
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"ignore": "^5.0.4",
|
|
33
33
|
"metro-config": "~0.76.8",
|
|
34
34
|
"metro-resolver": "~0.76.8",
|
|
35
|
-
"minimatch": "
|
|
35
|
+
"minimatch": "9.0.3",
|
|
36
36
|
"node-fetch": "^2.6.7",
|
|
37
37
|
"tsconfig-paths": "^4.1.2",
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
|
-
"@nx/detox": "17.3.0-beta.
|
|
40
|
-
"@nx/devkit": "17.3.0-beta.
|
|
41
|
-
"@nx/jest": "17.3.0-beta.
|
|
42
|
-
"@nx/js": "17.3.0-beta.
|
|
43
|
-
"@nx/eslint": "17.3.0-beta.
|
|
44
|
-
"@nx/react": "17.3.0-beta.
|
|
45
|
-
"@nx/workspace": "17.3.0-beta.
|
|
46
|
-
"@nrwl/react-native": "17.3.0-beta.
|
|
39
|
+
"@nx/detox": "17.3.0-beta.6",
|
|
40
|
+
"@nx/devkit": "17.3.0-beta.6",
|
|
41
|
+
"@nx/jest": "17.3.0-beta.6",
|
|
42
|
+
"@nx/js": "17.3.0-beta.6",
|
|
43
|
+
"@nx/eslint": "17.3.0-beta.6",
|
|
44
|
+
"@nx/react": "17.3.0-beta.6",
|
|
45
|
+
"@nx/workspace": "17.3.0-beta.6",
|
|
46
|
+
"@nrwl/react-native": "17.3.0-beta.6"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react-native": ">= 0.72.0 < 0.73.0"
|
package/plugins/plugin.d.ts
CHANGED
package/plugins/plugin.js
CHANGED
|
@@ -30,7 +30,6 @@ exports.createNodes = [
|
|
|
30
30
|
// Do not create a project if package.json or project.json or metro.config.js isn't there.
|
|
31
31
|
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
32
32
|
if (!siblingFiles.includes('package.json') ||
|
|
33
|
-
!siblingFiles.includes('project.json') ||
|
|
34
33
|
!siblingFiles.includes('metro.config.js')) {
|
|
35
34
|
return {};
|
|
36
35
|
}
|
|
@@ -58,8 +57,17 @@ function buildReactNativeTargets(projectRoot, options, context) {
|
|
|
58
57
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
59
58
|
const targets = {
|
|
60
59
|
[options.startTargetName]: {
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
executor: `@nx/react-native:start`,
|
|
61
|
+
},
|
|
62
|
+
[options.podInstallTargetName]: {
|
|
63
|
+
command: `pod install`,
|
|
64
|
+
options: { cwd: (0, devkit_1.joinPathFragments)(projectRoot, 'ios') },
|
|
65
|
+
cache: true,
|
|
66
|
+
inputs: getInputs(namedInputs),
|
|
67
|
+
outputs: [
|
|
68
|
+
getOutputs(projectRoot, 'ios/Pods'),
|
|
69
|
+
getOutputs(projectRoot, 'ios/Podfile.lock'),
|
|
70
|
+
],
|
|
63
71
|
},
|
|
64
72
|
[options.runIosTargetName]: {
|
|
65
73
|
command: `react-native run-ios`,
|
|
@@ -133,6 +141,7 @@ function load(path) {
|
|
|
133
141
|
function normalizeOptions(options) {
|
|
134
142
|
options ??= {};
|
|
135
143
|
options.startTargetName ??= 'start';
|
|
144
|
+
options.podInstallTargetName ??= 'pod-install';
|
|
136
145
|
options.runIosTargetName ??= 'run-ios';
|
|
137
146
|
options.runAndroidTargetName ??= 'run-android';
|
|
138
147
|
options.buildIosTargetName ??= 'build-ios';
|
|
@@ -7,6 +7,7 @@ const symlink_task_1 = require("../../utils/symlink-task");
|
|
|
7
7
|
const add_linting_1 = require("../../utils/add-linting");
|
|
8
8
|
const add_jest_1 = require("../../utils/add-jest");
|
|
9
9
|
const chmod_android_gradle_files_1 = require("../../utils/chmod-android-gradle-files");
|
|
10
|
+
const pod_install_task_1 = require("../../utils/pod-install-task");
|
|
10
11
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
12
|
const init_1 = require("../init/init");
|
|
12
13
|
const add_project_1 = require("./lib/add-project");
|
|
@@ -51,6 +52,10 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
51
52
|
tasks.push(symlinkTask);
|
|
52
53
|
const chmodTaskGradlewTask = (0, chmod_android_gradle_files_1.chmodAndroidGradlewFilesTask)((0, devkit_1.joinPathFragments)(host.root, options.androidProjectRoot));
|
|
53
54
|
tasks.push(chmodTaskGradlewTask);
|
|
55
|
+
const podInstallTask = (0, pod_install_task_1.runPodInstall)((0, devkit_1.joinPathFragments)(host.root, options.iosProjectRoot));
|
|
56
|
+
if (options.install) {
|
|
57
|
+
tasks.push(podInstallTask);
|
|
58
|
+
}
|
|
54
59
|
if (!options.skipFormat) {
|
|
55
60
|
await (0, devkit_1.formatFiles)(host);
|
|
56
61
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function reactNativeInitGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
-
export declare function updateDependencies(host: Tree): GeneratorCallback;
|
|
4
|
+
export declare function updateDependencies(host: Tree, schema: Schema): GeneratorCallback;
|
|
5
5
|
export default reactNativeInitGenerator;
|
|
@@ -12,7 +12,7 @@ async function reactNativeInitGenerator(host, schema) {
|
|
|
12
12
|
const tasks = [];
|
|
13
13
|
if (!schema.skipPackageJson) {
|
|
14
14
|
tasks.push(moveDependency(host));
|
|
15
|
-
tasks.push(updateDependencies(host));
|
|
15
|
+
tasks.push(updateDependencies(host, schema));
|
|
16
16
|
}
|
|
17
17
|
if (!schema.skipFormat) {
|
|
18
18
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -20,7 +20,7 @@ async function reactNativeInitGenerator(host, schema) {
|
|
|
20
20
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
21
21
|
}
|
|
22
22
|
exports.reactNativeInitGenerator = reactNativeInitGenerator;
|
|
23
|
-
function updateDependencies(host) {
|
|
23
|
+
function updateDependencies(host, schema) {
|
|
24
24
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
25
25
|
react: versions_1.reactVersion,
|
|
26
26
|
'react-dom': versions_1.reactDomVersion,
|
|
@@ -30,7 +30,7 @@ function updateDependencies(host) {
|
|
|
30
30
|
'@react-native-community/cli': versions_1.reactNativeCommunityCli,
|
|
31
31
|
'@react-native-community/cli-platform-android': versions_1.reactNativeCommunityCliAndroid,
|
|
32
32
|
'@react-native-community/cli-platform-ios': versions_1.reactNativeCommunityCliIos,
|
|
33
|
-
});
|
|
33
|
+
}, undefined, schema.keepExistingVersions);
|
|
34
34
|
}
|
|
35
35
|
exports.updateDependencies = updateDependencies;
|
|
36
36
|
function moveDependency(host) {
|
|
@@ -50,6 +50,7 @@ function addPlugin(host) {
|
|
|
50
50
|
plugin: '@nx/react-native/plugin',
|
|
51
51
|
options: {
|
|
52
52
|
startTargetName: 'start',
|
|
53
|
+
podInstallTargetName: 'pod-install',
|
|
53
54
|
bundleTargetName: 'bundle',
|
|
54
55
|
runIosTargetName: 'run-ios',
|
|
55
56
|
runAndroidTargetName: 'run-android',
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"type": "boolean",
|
|
18
18
|
"default": false,
|
|
19
19
|
"x-priority": "internal"
|
|
20
|
+
},
|
|
21
|
+
"keepExistingVersions": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"x-priority": "internal",
|
|
24
|
+
"description": "Keep existing dependencies versions",
|
|
25
|
+
"default": false
|
|
20
26
|
}
|
|
21
27
|
},
|
|
22
28
|
"required": []
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const component_story_1 = require("../component-story/component-story");
|
|
7
7
|
const stories_1 = require("@nx/react/src/generators/stories/stories");
|
|
8
|
-
const
|
|
8
|
+
const minimatch_1 = require("minimatch");
|
|
9
9
|
const versions_1 = require("../../utils/versions");
|
|
10
10
|
async function createAllStories(tree, projectName, ignorePaths) {
|
|
11
11
|
(0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
|
@@ -16,7 +16,7 @@ async function createAllStories(tree, projectName, ignorePaths) {
|
|
|
16
16
|
const projectPath = await (0, stories_1.projectRootPath)(tree, projectConfiguration);
|
|
17
17
|
let componentPaths = [];
|
|
18
18
|
(0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (path) => {
|
|
19
|
-
if (ignorePaths?.some((pattern) => minimatch(path, pattern)))
|
|
19
|
+
if (ignorePaths?.some((pattern) => (0, minimatch_1.minimatch)(path, pattern)))
|
|
20
20
|
return;
|
|
21
21
|
if ((path.endsWith('.tsx') && !path.endsWith('.spec.tsx')) ||
|
|
22
22
|
(path.endsWith('.js') && !path.endsWith('.spec.js')) ||
|