@nx/react-native 0.0.0-pr-30111-5026d75 → 0.0.0-pr-30250-ec5f231
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 +7 -7
- package/src/generators/application/application.js +5 -5
- package/src/generators/application/lib/add-e2e.js +0 -2
- package/src/generators/application/lib/add-project.js +7 -15
- package/src/generators/application/lib/normalize-options.d.ts +1 -2
- package/src/generators/application/lib/normalize-options.js +8 -7
- package/src/generators/library/lib/normalize-options.d.ts +0 -1
- package/src/generators/library/lib/normalize-options.js +5 -2
- package/src/generators/library/library.js +9 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-30250-ec5f231",
|
|
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": [
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"picocolors": "^1.1.0",
|
|
36
36
|
"tsconfig-paths": "^4.1.2",
|
|
37
37
|
"tslib": "^2.3.0",
|
|
38
|
-
"@nx/devkit": "0.0.0-pr-
|
|
39
|
-
"@nx/jest": "0.0.0-pr-
|
|
40
|
-
"@nx/js": "0.0.0-pr-
|
|
41
|
-
"@nx/eslint": "0.0.0-pr-
|
|
42
|
-
"@nx/react": "0.0.0-pr-
|
|
43
|
-
"@nx/workspace": "0.0.0-pr-
|
|
38
|
+
"@nx/devkit": "0.0.0-pr-30250-ec5f231",
|
|
39
|
+
"@nx/jest": "0.0.0-pr-30250-ec5f231",
|
|
40
|
+
"@nx/js": "0.0.0-pr-30250-ec5f231",
|
|
41
|
+
"@nx/eslint": "0.0.0-pr-30250-ec5f231",
|
|
42
|
+
"@nx/react": "0.0.0-pr-30250-ec5f231",
|
|
43
|
+
"@nx/workspace": "0.0.0-pr-30250-ec5f231"
|
|
44
44
|
},
|
|
45
45
|
"executors": "./executors.json",
|
|
46
46
|
"ng-update": {
|
|
@@ -43,11 +43,6 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
43
43
|
}
|
|
44
44
|
await (0, create_application_files_1.createApplicationFiles)(host, options);
|
|
45
45
|
(0, add_project_1.addProject)(host, options);
|
|
46
|
-
// If we are using the new TS solution
|
|
47
|
-
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
48
|
-
if (options.isTsSolutionSetup) {
|
|
49
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
50
|
-
}
|
|
51
46
|
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
52
47
|
...options,
|
|
53
48
|
projectRoot: options.appProjectRoot,
|
|
@@ -93,6 +88,11 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
93
88
|
}, options.linter === 'eslint'
|
|
94
89
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
95
90
|
: undefined);
|
|
91
|
+
// If we are using the new TS solution
|
|
92
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
93
|
+
if (options.useTsSolution) {
|
|
94
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
95
|
+
}
|
|
96
96
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.appProjectRoot);
|
|
97
97
|
if (!options.skipFormat) {
|
|
98
98
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -14,7 +14,6 @@ async function addE2e(host, options) {
|
|
|
14
14
|
styledModule: null,
|
|
15
15
|
hasStyles: false,
|
|
16
16
|
unitTestRunner: 'none',
|
|
17
|
-
names: (0, devkit_1.names)(options.name),
|
|
18
17
|
});
|
|
19
18
|
case 'playwright':
|
|
20
19
|
return (0, add_e2e_1.addE2e)(host, {
|
|
@@ -24,7 +23,6 @@ async function addE2e(host, options) {
|
|
|
24
23
|
styledModule: null,
|
|
25
24
|
hasStyles: false,
|
|
26
25
|
unitTestRunner: 'none',
|
|
27
|
-
names: (0, devkit_1.names)(options.name),
|
|
28
26
|
});
|
|
29
27
|
case 'detox':
|
|
30
28
|
const { detoxApplicationGenerator } = (0, devkit_1.ensurePackage)('@nx/detox', versions_1.nxVersion);
|
|
@@ -16,23 +16,15 @@ function addProject(host, options) {
|
|
|
16
16
|
tags: options.parsedTags,
|
|
17
17
|
};
|
|
18
18
|
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
19
|
-
|
|
20
|
-
name: options.
|
|
19
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), {
|
|
20
|
+
name: options.projectName,
|
|
21
21
|
version: '0.0.1',
|
|
22
22
|
private: true,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
packageJson.nx ??= {};
|
|
29
|
-
packageJson.nx.targets = getTargets(options);
|
|
30
|
-
}
|
|
31
|
-
if (options.parsedTags?.length) {
|
|
32
|
-
packageJson.nx ??= {};
|
|
33
|
-
packageJson.nx.tags = options.parsedTags;
|
|
34
|
-
}
|
|
35
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
23
|
+
nx: {
|
|
24
|
+
targets: hasPlugin ? {} : getTargets(options),
|
|
25
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
36
28
|
}
|
|
37
29
|
else {
|
|
38
30
|
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
|
-
export interface NormalizedSchema extends
|
|
3
|
+
export interface NormalizedSchema extends Schema {
|
|
4
4
|
className: string;
|
|
5
5
|
fileName: string;
|
|
6
6
|
projectName: string;
|
|
@@ -13,7 +13,6 @@ export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
|
|
|
13
13
|
rootProject: boolean;
|
|
14
14
|
e2eProjectName: string;
|
|
15
15
|
e2eProjectRoot: string;
|
|
16
|
-
importPath: string;
|
|
17
16
|
isTsSolutionSetup: boolean;
|
|
18
17
|
}
|
|
19
18
|
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -4,9 +4,10 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
7
8
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
9
|
-
const { projectName, names: projectNames, projectRoot: appProjectRoot,
|
|
9
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
10
|
+
const { projectName: appProjectName, names: projectNames, projectRoot: appProjectRoot, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
11
|
name: options.name,
|
|
11
12
|
projectType: 'application',
|
|
12
13
|
directory: options.directory,
|
|
@@ -15,18 +16,17 @@ async function normalizeOptions(host, options) {
|
|
|
15
16
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
17
|
nxJson.useInferencePlugins !== false;
|
|
17
18
|
options.addPlugin ??= addPluginDefault;
|
|
18
|
-
const { className, fileName } = (0, devkit_1.names)(
|
|
19
|
+
const { className, fileName } = (0, devkit_1.names)(options.name);
|
|
19
20
|
const iosProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'ios');
|
|
20
21
|
const androidProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'android');
|
|
21
22
|
const rootProject = appProjectRoot === '.';
|
|
22
|
-
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
23
|
-
const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath;
|
|
24
23
|
const e2eProjectName = rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
25
24
|
const e2eProjectRoot = rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
26
25
|
const parsedTags = options.tags
|
|
27
26
|
? options.tags.split(',').map((s) => s.trim())
|
|
28
27
|
: [];
|
|
29
28
|
const entryFile = options.js ? 'src/main.js' : 'src/main.tsx';
|
|
29
|
+
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
30
30
|
return {
|
|
31
31
|
...options,
|
|
32
32
|
name: projectNames.projectSimpleName,
|
|
@@ -34,9 +34,10 @@ async function normalizeOptions(host, options) {
|
|
|
34
34
|
fileName,
|
|
35
35
|
lowerCaseName: className.toLowerCase(),
|
|
36
36
|
displayName: options.displayName || className,
|
|
37
|
-
projectName:
|
|
37
|
+
projectName: isTsSolutionSetup
|
|
38
|
+
? (0, get_import_path_1.getImportPath)(host, appProjectName)
|
|
39
|
+
: appProjectName,
|
|
38
40
|
appProjectRoot,
|
|
39
|
-
importPath,
|
|
40
41
|
iosProjectRoot,
|
|
41
42
|
androidProjectRoot,
|
|
42
43
|
parsedTags,
|
|
@@ -4,8 +4,9 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
7
8
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
9
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
9
10
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
11
|
name: options.name,
|
|
11
12
|
projectType: 'library',
|
|
@@ -24,7 +25,9 @@ async function normalizeOptions(host, options) {
|
|
|
24
25
|
...options,
|
|
25
26
|
fileName: projectName,
|
|
26
27
|
routePath: `/${projectNames.projectSimpleName}`,
|
|
27
|
-
name: isUsingTsSolutionConfig
|
|
28
|
+
name: isUsingTsSolutionConfig
|
|
29
|
+
? options.importPath ?? (0, get_import_path_1.getImportPath)(host, projectName)
|
|
30
|
+
: projectName,
|
|
28
31
|
projectRoot,
|
|
29
32
|
parsedTags,
|
|
30
33
|
importPath,
|
|
@@ -44,9 +44,6 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
|
44
44
|
if (addProjectTask) {
|
|
45
45
|
tasks.push(addProjectTask);
|
|
46
46
|
}
|
|
47
|
-
if (options.isUsingTsSolutionConfig) {
|
|
48
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
49
|
-
}
|
|
50
47
|
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
51
48
|
...options,
|
|
52
49
|
projectName: options.name,
|
|
@@ -79,6 +76,9 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
|
79
76
|
}, options.linter === 'eslint'
|
|
80
77
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
81
78
|
: undefined);
|
|
79
|
+
if (options.isUsingTsSolutionConfig) {
|
|
80
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
81
|
+
}
|
|
82
82
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
83
83
|
if (!options.skipFormat) {
|
|
84
84
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -101,24 +101,19 @@ async function addProject(host, options) {
|
|
|
101
101
|
targets: {},
|
|
102
102
|
};
|
|
103
103
|
if (options.isUsingTsSolutionConfig) {
|
|
104
|
-
|
|
105
|
-
name: options.
|
|
104
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
105
|
+
name: options.name,
|
|
106
106
|
version: '0.0.1',
|
|
107
107
|
...determineEntryFields(options),
|
|
108
|
+
nx: {
|
|
109
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
110
|
+
},
|
|
108
111
|
files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
|
|
109
112
|
peerDependencies: {
|
|
110
113
|
react: versions_1.reactVersion,
|
|
111
114
|
'react-native': versions_1.reactNativeVersion,
|
|
112
115
|
},
|
|
113
|
-
};
|
|
114
|
-
if (options.name !== options.importPath) {
|
|
115
|
-
packageJson.nx = { name: options.name };
|
|
116
|
-
}
|
|
117
|
-
if (options.parsedTags?.length) {
|
|
118
|
-
packageJson.nx ??= {};
|
|
119
|
-
packageJson.nx.tags = options.parsedTags;
|
|
120
|
-
}
|
|
121
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
|
|
116
|
+
});
|
|
122
117
|
}
|
|
123
118
|
else {
|
|
124
119
|
(0, devkit_1.addProjectConfiguration)(host, options.name, project);
|