@nx/react-native 0.0.0-pr-28218-5048fd1 → 0.0.0-pr-28229-afe192c
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/lib/add-e2e.js +0 -1
- package/src/generators/application/lib/normalize-options.js +2 -3
- package/src/generators/application/schema.d.ts +2 -4
- package/src/generators/application/schema.json +9 -14
- package/src/generators/component/lib/normalize-options.d.ts +1 -0
- package/src/generators/component/lib/normalize-options.js +4 -4
- package/src/generators/component/schema.d.ts +2 -5
- package/src/generators/component/schema.json +10 -15
- package/src/generators/library/lib/normalize-options.js +1 -1
- package/src/generators/library/schema.d.ts +2 -4
- package/src/generators/library/schema.json +8 -13
- package/src/utils/testing-generators.js +1 -2
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-28229-afe192c",
|
|
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": [
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"node-fetch": "^2.6.7",
|
|
37
37
|
"tsconfig-paths": "^4.1.2",
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
|
-
"@nx/devkit": "0.0.0-pr-
|
|
40
|
-
"@nx/jest": "0.0.0-pr-
|
|
41
|
-
"@nx/js": "0.0.0-pr-
|
|
42
|
-
"@nx/eslint": "0.0.0-pr-
|
|
43
|
-
"@nx/react": "0.0.0-pr-
|
|
44
|
-
"@nx/workspace": "0.0.0-pr-
|
|
39
|
+
"@nx/devkit": "0.0.0-pr-28229-afe192c",
|
|
40
|
+
"@nx/jest": "0.0.0-pr-28229-afe192c",
|
|
41
|
+
"@nx/js": "0.0.0-pr-28229-afe192c",
|
|
42
|
+
"@nx/eslint": "0.0.0-pr-28229-afe192c",
|
|
43
|
+
"@nx/react": "0.0.0-pr-28229-afe192c",
|
|
44
|
+
"@nx/workspace": "0.0.0-pr-28229-afe192c"
|
|
45
45
|
},
|
|
46
46
|
"executors": "./executors.json",
|
|
47
47
|
"ng-update": {
|
|
@@ -30,7 +30,6 @@ async function addE2e(host, options) {
|
|
|
30
30
|
...options,
|
|
31
31
|
e2eName: options.e2eProjectName,
|
|
32
32
|
e2eDirectory: options.e2eProjectRoot,
|
|
33
|
-
projectNameAndRootFormat: 'as-provided',
|
|
34
33
|
appProject: options.projectName,
|
|
35
34
|
appDisplayName: options.displayName,
|
|
36
35
|
appName: options.name,
|
|
@@ -4,13 +4,12 @@ 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
|
async function normalizeOptions(host, options) {
|
|
7
|
-
|
|
7
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
8
|
+
const { projectName: appProjectName, names: projectNames, projectRoot: appProjectRoot, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
9
|
name: options.name,
|
|
9
10
|
projectType: 'application',
|
|
10
11
|
directory: options.directory,
|
|
11
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
12
12
|
});
|
|
13
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
14
13
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
15
14
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
15
|
nxJson.useInferencePlugins !== false;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
export interface Schema {
|
|
5
|
-
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
displayName?: string;
|
|
7
7
|
style?: string;
|
|
8
8
|
skipFormat?: boolean;
|
|
9
|
-
directory?: string;
|
|
10
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
11
9
|
tags?: string;
|
|
12
10
|
unitTestRunner: 'jest' | 'none'; // default is jest
|
|
13
11
|
classComponent?: boolean;
|
|
@@ -16,29 +16,24 @@
|
|
|
16
16
|
],
|
|
17
17
|
"type": "object",
|
|
18
18
|
"properties": {
|
|
19
|
-
"
|
|
20
|
-
"description": "The
|
|
19
|
+
"directory": {
|
|
20
|
+
"description": "The directory of the new application.",
|
|
21
21
|
"type": "string",
|
|
22
22
|
"$default": {
|
|
23
23
|
"$source": "argv",
|
|
24
24
|
"index": 0
|
|
25
25
|
},
|
|
26
|
-
"x-prompt": "
|
|
27
|
-
"pattern": "^[a-zA-Z][^:]*$"
|
|
26
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
28
27
|
},
|
|
29
|
-
"
|
|
30
|
-
"description": "The
|
|
28
|
+
"name": {
|
|
29
|
+
"description": "The name of the application.",
|
|
30
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
|
31
31
|
"type": "string"
|
|
32
32
|
},
|
|
33
|
-
"
|
|
34
|
-
"description": "The
|
|
33
|
+
"displayName": {
|
|
34
|
+
"description": "The display name to show in the application. Defaults to name.",
|
|
35
35
|
"type": "string"
|
|
36
36
|
},
|
|
37
|
-
"projectNameAndRootFormat": {
|
|
38
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
39
|
-
"type": "string",
|
|
40
|
-
"enum": ["as-provided", "derived"]
|
|
41
|
-
},
|
|
42
37
|
"skipFormat": {
|
|
43
38
|
"description": "Skip formatting files",
|
|
44
39
|
"type": "boolean",
|
|
@@ -99,5 +94,5 @@
|
|
|
99
94
|
"x-priority": "important"
|
|
100
95
|
}
|
|
101
96
|
},
|
|
102
|
-
"required": []
|
|
97
|
+
"required": ["directory"]
|
|
103
98
|
}
|
|
@@ -4,13 +4,12 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
6
6
|
async function normalizeOptions(host, options) {
|
|
7
|
-
assertValidOptions(options);
|
|
8
7
|
const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
8
|
+
path: options.path,
|
|
9
9
|
name: options.name,
|
|
10
|
-
directory: options.directory,
|
|
11
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
12
10
|
fileExtension: 'tsx',
|
|
13
11
|
});
|
|
12
|
+
assertValidOptions({ name, directory });
|
|
14
13
|
const project = (0, devkit_1.getProjects)(host).get(projectName);
|
|
15
14
|
const { className } = (0, devkit_1.names)(name);
|
|
16
15
|
const { sourceRoot: projectSourceRoot, projectType } = project;
|
|
@@ -20,6 +19,7 @@ async function normalizeOptions(host, options) {
|
|
|
20
19
|
options.classComponent = options.classComponent ?? false;
|
|
21
20
|
return {
|
|
22
21
|
...options,
|
|
22
|
+
name,
|
|
23
23
|
directory,
|
|
24
24
|
className,
|
|
25
25
|
fileName,
|
|
@@ -37,7 +37,7 @@ function assertValidOptions(options) {
|
|
|
37
37
|
if (options.directory) {
|
|
38
38
|
suggestion = `${options.directory}${s}${suggestion}`;
|
|
39
39
|
}
|
|
40
|
-
throw new Error(`Found "${s}" in the component name. Did you mean to use the --
|
|
40
|
+
throw new Error(`Found "${s}" in the component name. Did you mean to use the --path option (e.g. \`nx g c ${suggestion}/${name} \`)?`);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Same as the @nx/react library schema, except it removes keys: style, routing, globalCss
|
|
5
3
|
*/
|
|
6
4
|
export interface Schema {
|
|
7
|
-
|
|
5
|
+
path: string;
|
|
6
|
+
name?: string;
|
|
8
7
|
skipTests?: boolean;
|
|
9
|
-
directory?: string;
|
|
10
8
|
export?: boolean;
|
|
11
9
|
classComponent?: boolean;
|
|
12
10
|
js?: boolean;
|
|
13
|
-
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
14
11
|
}
|
|
@@ -7,22 +7,27 @@
|
|
|
7
7
|
"type": "object",
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
|
-
"command": "nx g @nx/react-native:component
|
|
10
|
+
"command": "nx g @nx/react-native:component mylib/src/lib/my-component/my-component ",
|
|
11
11
|
"description": "Generate a component in the `mylib` library"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
"command": "nx g @nx/react-native:component
|
|
14
|
+
"command": "nx g @nx/react-native:component mylib/src/lib/my-component/my-component --classComponent",
|
|
15
15
|
"description": "Generate a class component in the `mylib` library"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"properties": {
|
|
19
|
-
"
|
|
19
|
+
"path": {
|
|
20
20
|
"type": "string",
|
|
21
|
-
"description": "The
|
|
21
|
+
"description": "The path at which to create the component file.",
|
|
22
22
|
"$default": {
|
|
23
23
|
"$source": "argv",
|
|
24
24
|
"index": 0
|
|
25
25
|
},
|
|
26
|
+
"x-prompt": "What path would you like to use for the component?"
|
|
27
|
+
},
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The name of the component.",
|
|
26
31
|
"x-prompt": "What name would you like to use for the component?"
|
|
27
32
|
},
|
|
28
33
|
"js": {
|
|
@@ -35,16 +40,6 @@
|
|
|
35
40
|
"description": "When true, does not create `spec.ts` test files for the new component.",
|
|
36
41
|
"default": false
|
|
37
42
|
},
|
|
38
|
-
"directory": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"description": "The directory at which to create the component file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the project root.",
|
|
41
|
-
"x-priority": "important"
|
|
42
|
-
},
|
|
43
|
-
"nameAndDirectoryFormat": {
|
|
44
|
-
"description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
45
|
-
"type": "string",
|
|
46
|
-
"enum": ["as-provided", "derived"]
|
|
47
|
-
},
|
|
48
43
|
"export": {
|
|
49
44
|
"type": "boolean",
|
|
50
45
|
"description": "When true, the component is exported from the project `index.ts` (if it exists).",
|
|
@@ -59,5 +54,5 @@
|
|
|
59
54
|
"default": false
|
|
60
55
|
}
|
|
61
56
|
},
|
|
62
|
-
"required": ["
|
|
57
|
+
"required": ["path"]
|
|
63
58
|
}
|
|
@@ -4,12 +4,12 @@ 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
|
async function normalizeOptions(host, options) {
|
|
7
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
7
8
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
9
|
name: options.name,
|
|
9
10
|
projectType: 'library',
|
|
10
11
|
directory: options.directory,
|
|
11
12
|
importPath: options.importPath,
|
|
12
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
13
|
});
|
|
14
14
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
15
15
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject
|
|
6
5
|
*/
|
|
7
6
|
export interface Schema {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
7
|
+
directory: string;
|
|
8
|
+
name?: string;
|
|
11
9
|
skipTsConfig: boolean;
|
|
12
10
|
skipFormat: boolean;
|
|
13
11
|
tags?: string;
|
|
@@ -12,27 +12,22 @@
|
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
15
|
-
"
|
|
15
|
+
"directory": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "A directory where the lib is placed.",
|
|
18
|
+
"alias": "dir",
|
|
18
19
|
"$default": {
|
|
19
20
|
"$source": "argv",
|
|
20
21
|
"index": 0
|
|
21
22
|
},
|
|
22
|
-
"x-prompt": "
|
|
23
|
-
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
|
|
23
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
25
|
+
"name": {
|
|
26
26
|
"type": "string",
|
|
27
|
-
"description": "
|
|
28
|
-
"
|
|
27
|
+
"description": "Library name.",
|
|
28
|
+
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
|
|
29
29
|
"x-priority": "important"
|
|
30
30
|
},
|
|
31
|
-
"projectNameAndRootFormat": {
|
|
32
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
33
|
-
"type": "string",
|
|
34
|
-
"enum": ["as-provided", "derived"]
|
|
35
|
-
},
|
|
36
31
|
"linter": {
|
|
37
32
|
"description": "The tool to use for running lint checks.",
|
|
38
33
|
"type": "string",
|
|
@@ -97,5 +92,5 @@
|
|
|
97
92
|
"x-priority": "internal"
|
|
98
93
|
}
|
|
99
94
|
},
|
|
100
|
-
"required": ["
|
|
95
|
+
"required": ["directory"]
|
|
101
96
|
}
|
|
@@ -11,10 +11,9 @@ async function createApp(tree, appName) {
|
|
|
11
11
|
skipFormat: true,
|
|
12
12
|
style: 'css',
|
|
13
13
|
unitTestRunner: 'none',
|
|
14
|
-
|
|
14
|
+
directory: appName,
|
|
15
15
|
e2eTestRunner: 'none',
|
|
16
16
|
install: false,
|
|
17
|
-
projectNameAndRootFormat: 'as-provided',
|
|
18
17
|
bundler: 'webpack',
|
|
19
18
|
});
|
|
20
19
|
}
|