@nx/react-native 0.0.0-pr-27957-a99d5ea → 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/.eslintrc.json +12 -0
- package/generators.json +1 -1
- package/package.json +8 -10
- package/plugins/with-nx-metro.js +4 -4
- package/project.json +0 -3
- package/src/executors/storybook/storybook.impl.js +2 -2
- package/src/generators/application/application.js +0 -1
- package/src/generators/application/files/app/android/gradlew.template +0 -0
- package/src/generators/application/lib/add-e2e.js +0 -1
- package/src/generators/application/lib/normalize-options.js +2 -4
- package/src/generators/application/schema.d.ts +2 -5
- package/src/generators/application/schema.json +9 -14
- package/src/generators/component/component.d.ts +0 -1
- package/src/generators/component/component.js +0 -7
- package/src/generators/component/lib/normalize-options.d.ts +1 -0
- package/src/generators/component/lib/normalize-options.js +4 -10
- package/src/generators/component/schema.d.ts +2 -15
- package/src/generators/component/schema.json +8 -35
- package/src/generators/library/lib/normalize-options.js +1 -2
- package/src/generators/library/library.js +0 -1
- package/src/generators/library/schema.d.ts +2 -5
- package/src/generators/library/schema.json +8 -19
- package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +0 -7
- package/src/migrations/update-18-0-0/remove-symlink-target.js +2 -2
- package/src/utils/ensure-node-modules-symlink.js +6 -6
- package/src/utils/pod-install-task.js +6 -4
- package/src/utils/testing-generators.js +1 -2
package/.eslintrc.json
CHANGED
|
@@ -43,6 +43,18 @@
|
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
49
|
+
"rules": {
|
|
50
|
+
"no-restricted-imports": [
|
|
51
|
+
"error",
|
|
52
|
+
{
|
|
53
|
+
"name": "fs-extra",
|
|
54
|
+
"message": "Please use equivalent utilities from `node:fs` instead."
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
46
58
|
}
|
|
47
59
|
]
|
|
48
60
|
}
|
package/generators.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"description": "Create a React Native library."
|
|
25
25
|
},
|
|
26
26
|
"component": {
|
|
27
|
-
"factory": "./src/generators/component/component
|
|
27
|
+
"factory": "./src/generators/component/component",
|
|
28
28
|
"schema": "./src/generators/component/schema.json",
|
|
29
29
|
"description": "Create a React Native component.",
|
|
30
30
|
"aliases": ["c"]
|
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": [
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"ajv": "^8.12.0",
|
|
30
30
|
"chalk": "^4.1.0",
|
|
31
31
|
"enhanced-resolve": "^5.8.3",
|
|
32
|
-
"fs-extra": "^11.1.0",
|
|
33
32
|
"glob": "7.1.4",
|
|
34
33
|
"ignore": "^5.0.4",
|
|
35
34
|
"metro-config": "~0.80.4",
|
|
@@ -37,13 +36,12 @@
|
|
|
37
36
|
"node-fetch": "^2.6.7",
|
|
38
37
|
"tsconfig-paths": "^4.1.2",
|
|
39
38
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/devkit": "0.0.0-pr-
|
|
41
|
-
"@nx/jest": "0.0.0-pr-
|
|
42
|
-
"@nx/js": "0.0.0-pr-
|
|
43
|
-
"@nx/eslint": "0.0.0-pr-
|
|
44
|
-
"@nx/react": "0.0.0-pr-
|
|
45
|
-
"@nx/workspace": "0.0.0-pr-
|
|
46
|
-
"@nrwl/react-native": "0.0.0-pr-27957-a99d5ea"
|
|
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"
|
|
47
45
|
},
|
|
48
46
|
"executors": "./executors.json",
|
|
49
47
|
"ng-update": {
|
|
@@ -55,4 +53,4 @@
|
|
|
55
53
|
"access": "public"
|
|
56
54
|
},
|
|
57
55
|
"type": "commonjs"
|
|
58
|
-
}
|
|
56
|
+
}
|
package/plugins/with-nx-metro.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withNxMetro = withNxMetro;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const metro_config_1 = require("metro-config");
|
|
6
|
-
const
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const metro_resolver_1 = require("./metro-resolver");
|
|
9
9
|
async function withNxMetro(userConfig, opts = {}) {
|
|
@@ -12,14 +12,14 @@ async function withNxMetro(userConfig, opts = {}) {
|
|
|
12
12
|
process.env.NX_REACT_NATIVE_DEBUG = 'true';
|
|
13
13
|
if (opts.extensions)
|
|
14
14
|
extensions.push(...opts.extensions);
|
|
15
|
-
let watchFolders = (0,
|
|
15
|
+
let watchFolders = (0, node_fs_1.readdirSync)(devkit_1.workspaceRoot)
|
|
16
16
|
.filter((fileName) => !['dist', 'e2e'].includes(fileName) && !fileName.startsWith('.'))
|
|
17
17
|
.map((fileName) => (0, path_1.join)(devkit_1.workspaceRoot, fileName))
|
|
18
|
-
.filter((filePath) => (0,
|
|
18
|
+
.filter((filePath) => (0, node_fs_1.statSync)(filePath).isDirectory());
|
|
19
19
|
if (opts.watchFolders?.length) {
|
|
20
20
|
watchFolders = watchFolders.concat(opts.watchFolders);
|
|
21
21
|
}
|
|
22
|
-
watchFolders = [...new Set(watchFolders)].filter((folder) => (0,
|
|
22
|
+
watchFolders = [...new Set(watchFolders)].filter((folder) => (0, node_fs_1.existsSync)(folder));
|
|
23
23
|
const nxConfig = {
|
|
24
24
|
resolver: {
|
|
25
25
|
resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions, opts.exportsConditionNames, opts.mainFields),
|
package/project.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = reactNativeStorybookExecutor;
|
|
4
4
|
exports.runCliStorybook = runCliStorybook;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
|
|
8
9
|
const chalk = require("chalk");
|
|
9
10
|
const glob_1 = require("glob");
|
|
10
11
|
const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
|
|
11
|
-
const fs_extra_1 = require("fs-extra");
|
|
12
12
|
/**
|
|
13
13
|
* TODO (@xiongemi): remove this function in v20.
|
|
14
14
|
* @deprecated Going to use the default react storybook target. Use @nx/react:storybook executor instead.
|
|
@@ -53,5 +53,5 @@ export function loadStories() {
|
|
|
53
53
|
${storiesFiles.map((story) => `require('${story}')`).join(',\n')}
|
|
54
54
|
];
|
|
55
55
|
}`;
|
|
56
|
-
(0,
|
|
56
|
+
(0, node_fs_1.writeFileSync)((0, path_1.join)(workspaceRoot, options.outputFile), newContents);
|
|
57
57
|
}
|
|
@@ -20,7 +20,6 @@ const sync_deps_impl_1 = require("../../executors/sync-deps/sync-deps.impl");
|
|
|
20
20
|
async function reactNativeApplicationGenerator(host, schema) {
|
|
21
21
|
return await reactNativeApplicationGeneratorInternal(host, {
|
|
22
22
|
addPlugin: false,
|
|
23
|
-
projectNameAndRootFormat: 'derived',
|
|
24
23
|
...schema,
|
|
25
24
|
});
|
|
26
25
|
}
|
|
File without changes
|
|
@@ -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,14 +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
|
-
callingGenerator: '@nx/react-native:application',
|
|
13
12
|
});
|
|
14
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
15
13
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
16
14
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
15
|
nxJson.useInferencePlugins !== false;
|
|
@@ -1,16 +1,13 @@
|
|
|
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
|
-
pascalCaseFiles?: boolean;
|
|
14
11
|
classComponent?: boolean;
|
|
15
12
|
js?: boolean;
|
|
16
13
|
linter: Linter | LinterType;
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Schema } from './schema';
|
|
2
2
|
import { Tree } from '@nx/devkit';
|
|
3
3
|
export declare function reactNativeComponentGenerator(host: Tree, schema: Schema): Promise<void>;
|
|
4
|
-
export declare function reactNativeComponentGeneratorInternal(host: Tree, schema: Schema): Promise<void>;
|
|
5
4
|
export default reactNativeComponentGenerator;
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reactNativeComponentGenerator = reactNativeComponentGenerator;
|
|
4
|
-
exports.reactNativeComponentGeneratorInternal = reactNativeComponentGeneratorInternal;
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
7
6
|
const add_import_1 = require("./lib/add-import");
|
|
8
7
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
9
8
|
const path_1 = require("path");
|
|
10
9
|
async function reactNativeComponentGenerator(host, schema) {
|
|
11
|
-
return reactNativeComponentGeneratorInternal(host, {
|
|
12
|
-
nameAndDirectoryFormat: 'derived',
|
|
13
|
-
...schema,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async function reactNativeComponentGeneratorInternal(host, schema) {
|
|
17
10
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
18
11
|
createComponentFiles(host, options);
|
|
19
12
|
addExportsToBarrel(host, options);
|
|
@@ -4,19 +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, {
|
|
9
|
-
|
|
10
|
-
callingGenerator: '@nx/react-native:component',
|
|
8
|
+
path: options.path,
|
|
11
9
|
name: options.name,
|
|
12
|
-
directory: options.directory,
|
|
13
|
-
derivedDirectory: options.directory,
|
|
14
|
-
flat: options.flat,
|
|
15
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
16
|
-
project: options.project,
|
|
17
10
|
fileExtension: 'tsx',
|
|
18
|
-
pascalCaseFile: options.pascalCaseFiles,
|
|
19
11
|
});
|
|
12
|
+
assertValidOptions({ name, directory });
|
|
20
13
|
const project = (0, devkit_1.getProjects)(host).get(projectName);
|
|
21
14
|
const { className } = (0, devkit_1.names)(name);
|
|
22
15
|
const { sourceRoot: projectSourceRoot, projectType } = project;
|
|
@@ -26,6 +19,7 @@ async function normalizeOptions(host, options) {
|
|
|
26
19
|
options.classComponent = options.classComponent ?? false;
|
|
27
20
|
return {
|
|
28
21
|
...options,
|
|
22
|
+
name,
|
|
29
23
|
directory,
|
|
30
24
|
className,
|
|
31
25
|
fileName,
|
|
@@ -43,7 +37,7 @@ function assertValidOptions(options) {
|
|
|
43
37
|
if (options.directory) {
|
|
44
38
|
suggestion = `${options.directory}${s}${suggestion}`;
|
|
45
39
|
}
|
|
46
|
-
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} \`)?`);
|
|
47
41
|
}
|
|
48
42
|
});
|
|
49
43
|
}
|
|
@@ -2,23 +2,10 @@
|
|
|
2
2
|
* Same as the @nx/react library schema, except it removes keys: style, routing, globalCss
|
|
3
3
|
*/
|
|
4
4
|
export interface Schema {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v20.
|
|
8
|
-
*/
|
|
9
|
-
project: string;
|
|
5
|
+
path: string;
|
|
6
|
+
name?: string;
|
|
10
7
|
skipTests?: boolean;
|
|
11
|
-
directory?: string;
|
|
12
8
|
export?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19.
|
|
15
|
-
*/
|
|
16
|
-
pascalCaseFiles?: boolean;
|
|
17
9
|
classComponent?: boolean;
|
|
18
10
|
js?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19.
|
|
21
|
-
*/
|
|
22
|
-
flat?: boolean;
|
|
23
|
-
nameAndDirectoryFormat?: 'as-provided' | 'derived';
|
|
24
11
|
}
|
|
@@ -7,31 +7,27 @@
|
|
|
7
7
|
"type": "object",
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
|
-
"command": "nx g @nx/react-native:component my-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 my-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
|
|
22
|
-
"alias": "p",
|
|
21
|
+
"description": "The path at which to create the component file.",
|
|
23
22
|
"$default": {
|
|
24
|
-
"$source": "
|
|
23
|
+
"$source": "argv",
|
|
24
|
+
"index": 0
|
|
25
25
|
},
|
|
26
|
-
"x-
|
|
26
|
+
"x-prompt": "What path would you like to use for the component?"
|
|
27
27
|
},
|
|
28
28
|
"name": {
|
|
29
29
|
"type": "string",
|
|
30
30
|
"description": "The name of the component.",
|
|
31
|
-
"$default": {
|
|
32
|
-
"$source": "argv",
|
|
33
|
-
"index": 0
|
|
34
|
-
},
|
|
35
31
|
"x-prompt": "What name would you like to use for the component?"
|
|
36
32
|
},
|
|
37
33
|
"js": {
|
|
@@ -44,22 +40,6 @@
|
|
|
44
40
|
"description": "When true, does not create `spec.ts` test files for the new component.",
|
|
45
41
|
"default": false
|
|
46
42
|
},
|
|
47
|
-
"directory": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"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.",
|
|
50
|
-
"x-priority": "important"
|
|
51
|
-
},
|
|
52
|
-
"nameAndDirectoryFormat": {
|
|
53
|
-
"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`).",
|
|
54
|
-
"type": "string",
|
|
55
|
-
"enum": ["as-provided", "derived"]
|
|
56
|
-
},
|
|
57
|
-
"flat": {
|
|
58
|
-
"type": "boolean",
|
|
59
|
-
"description": "Create component at the source root rather than its own directory.",
|
|
60
|
-
"default": false,
|
|
61
|
-
"x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. This option will be removed in Nx v19."
|
|
62
|
-
},
|
|
63
43
|
"export": {
|
|
64
44
|
"type": "boolean",
|
|
65
45
|
"description": "When true, the component is exported from the project `index.ts` (if it exists).",
|
|
@@ -67,13 +47,6 @@
|
|
|
67
47
|
"default": false,
|
|
68
48
|
"x-prompt": "Should this component be exported in the project?"
|
|
69
49
|
},
|
|
70
|
-
"pascalCaseFiles": {
|
|
71
|
-
"type": "boolean",
|
|
72
|
-
"description": "Use pascal case component file name (e.g. `App.tsx`).",
|
|
73
|
-
"alias": "P",
|
|
74
|
-
"default": false,
|
|
75
|
-
"x-deprecated": "Provide the `name` in pascal-case and use the `as-provided` format. This option will be removed in Nx v19."
|
|
76
|
-
},
|
|
77
50
|
"classComponent": {
|
|
78
51
|
"type": "boolean",
|
|
79
52
|
"alias": "C",
|
|
@@ -81,5 +54,5 @@
|
|
|
81
54
|
"default": false
|
|
82
55
|
}
|
|
83
56
|
},
|
|
84
|
-
"required": ["
|
|
57
|
+
"required": ["path"]
|
|
85
58
|
}
|
|
@@ -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
|
+
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
|
-
callingGenerator: '@nx/react-native:library',
|
|
14
13
|
});
|
|
15
14
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
16
15
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -14,7 +14,6 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
|
|
|
14
14
|
async function reactNativeLibraryGenerator(host, schema) {
|
|
15
15
|
return await reactNativeLibraryGeneratorInternal(host, {
|
|
16
16
|
addPlugin: false,
|
|
17
|
-
projectNameAndRootFormat: 'derived',
|
|
18
17
|
...schema,
|
|
19
18
|
});
|
|
20
19
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
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;
|
|
14
|
-
pascalCaseFiles?: boolean;
|
|
15
12
|
unitTestRunner: 'jest' | 'none';
|
|
16
13
|
linter: Linter | LinterType;
|
|
17
14
|
publishable?: boolean;
|
|
@@ -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",
|
|
@@ -62,12 +57,6 @@
|
|
|
62
57
|
"description": "Do not update `tsconfig.json` for development experience.",
|
|
63
58
|
"x-priority": "internal"
|
|
64
59
|
},
|
|
65
|
-
"pascalCaseFiles": {
|
|
66
|
-
"type": "boolean",
|
|
67
|
-
"description": "Use pascal case component file name (e.g. `App.tsx`).",
|
|
68
|
-
"alias": "P",
|
|
69
|
-
"default": false
|
|
70
|
-
},
|
|
71
60
|
"publishable": {
|
|
72
61
|
"type": "boolean",
|
|
73
62
|
"description": "Create a publishable library."
|
|
@@ -103,5 +92,5 @@
|
|
|
103
92
|
"x-priority": "internal"
|
|
104
93
|
}
|
|
105
94
|
},
|
|
106
|
-
"required": ["
|
|
95
|
+
"required": ["directory"]
|
|
107
96
|
}
|
|
@@ -34,14 +34,12 @@ export default defineConfig({
|
|
|
34
34
|
define: {
|
|
35
35
|
global: 'window',
|
|
36
36
|
},
|
|
37
|
-
|
|
38
37
|
resolve: {
|
|
39
38
|
extensions,
|
|
40
39
|
alias: {
|
|
41
40
|
'react-native': 'react-native-web',
|
|
42
41
|
},
|
|
43
42
|
},
|
|
44
|
-
|
|
45
43
|
build: {
|
|
46
44
|
reportCompressedSize: true,
|
|
47
45
|
commonjsOptions: { transformMixedEsModules: true },
|
|
@@ -50,7 +48,6 @@ export default defineConfig({
|
|
|
50
48
|
plugins: [rollupPlugin([/react-native-vector-icons/])],
|
|
51
49
|
},
|
|
52
50
|
},
|
|
53
|
-
|
|
54
51
|
server: {
|
|
55
52
|
port: 4200,
|
|
56
53
|
host: 'localhost',
|
|
@@ -59,12 +56,10 @@ export default defineConfig({
|
|
|
59
56
|
allow: ['..'],
|
|
60
57
|
},
|
|
61
58
|
},
|
|
62
|
-
|
|
63
59
|
preview: {
|
|
64
60
|
port: 4300,
|
|
65
61
|
host: 'localhost',
|
|
66
62
|
},
|
|
67
|
-
|
|
68
63
|
optimizeDeps: {
|
|
69
64
|
esbuildOptions: {
|
|
70
65
|
resolveExtensions: extensions,
|
|
@@ -72,9 +67,7 @@ export default defineConfig({
|
|
|
72
67
|
loader: { '.js': 'jsx' },
|
|
73
68
|
},
|
|
74
69
|
},
|
|
75
|
-
|
|
76
70
|
plugins: [react(), nxViteTsPaths()],
|
|
77
|
-
|
|
78
71
|
// Uncomment this if you are using workers.
|
|
79
72
|
// worker: {
|
|
80
73
|
// plugins: [ nxViteTsPaths() ],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = update;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
6
|
/**
|
|
7
7
|
* Remove ensure-symlink target.
|
|
8
8
|
* It is going to be supported by react-native version 0.73 by default.
|
|
@@ -14,7 +14,7 @@ async function update(tree) {
|
|
|
14
14
|
'@nx/react-native:ensure-symlink') {
|
|
15
15
|
removeTargets(config.targets, 'ensure-symlink');
|
|
16
16
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
|
|
17
|
-
(0,
|
|
17
|
+
(0, node_fs_1.rmSync)(`${config.root}/node_modules`, { recursive: true, force: true });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureNodeModulesSymlink = ensureNodeModulesSymlink;
|
|
4
|
-
const
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
5
|
const os_1 = require("os");
|
|
6
|
-
const
|
|
6
|
+
const path_1 = require("path");
|
|
7
7
|
/**
|
|
8
8
|
* This function symlink workspace node_modules folder with app project's node_mdules folder.
|
|
9
9
|
* For yarn and npm, it will symlink the entire node_modules folder.
|
|
@@ -14,14 +14,14 @@ const fs_extra_1 = require("fs-extra");
|
|
|
14
14
|
*/
|
|
15
15
|
function ensureNodeModulesSymlink(workspaceRoot, projectRoot) {
|
|
16
16
|
const worksapceNodeModulesPath = (0, path_1.join)(workspaceRoot, 'node_modules');
|
|
17
|
-
if (!(0,
|
|
17
|
+
if (!(0, node_fs_1.existsSync)(worksapceNodeModulesPath)) {
|
|
18
18
|
throw new Error(`Cannot find ${worksapceNodeModulesPath}`);
|
|
19
19
|
}
|
|
20
20
|
const appNodeModulesPath = (0, path_1.join)(workspaceRoot, projectRoot, 'node_modules');
|
|
21
21
|
// `mklink /D` requires admin privilege in Windows so we need to use junction
|
|
22
22
|
const symlinkType = (0, os_1.platform)() === 'win32' ? 'junction' : 'dir';
|
|
23
|
-
if ((0,
|
|
24
|
-
(0,
|
|
23
|
+
if ((0, node_fs_1.existsSync)(appNodeModulesPath)) {
|
|
24
|
+
(0, node_fs_1.rmSync)(appNodeModulesPath, { recursive: true, force: true });
|
|
25
25
|
}
|
|
26
|
-
(0,
|
|
26
|
+
(0, node_fs_1.symlinkSync)(worksapceNodeModulesPath, appNodeModulesPath, symlinkType);
|
|
27
27
|
}
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runPodInstall = runPodInstall;
|
|
4
4
|
exports.podInstall = podInstall;
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
6
7
|
const os_1 = require("os");
|
|
8
|
+
const path_1 = require("path");
|
|
7
9
|
const chalk = require("chalk");
|
|
8
10
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const fs_extra_1 = require("fs-extra");
|
|
10
|
-
const path_1 = require("path");
|
|
11
11
|
const podInstallErrorMessage = `
|
|
12
12
|
Running ${chalk.bold('pod install')} failed, see above.
|
|
13
13
|
Do you have CocoaPods (https://cocoapods.org/) installed?
|
|
@@ -34,7 +34,7 @@ function runPodInstall(iosDirectory, install = true, options = {
|
|
|
34
34
|
devkit_1.logger.info('Skipping `pod install` on non-darwin platform');
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
if (!install || !(0,
|
|
37
|
+
if (!install || !(0, node_fs_1.existsSync)((0, path_1.join)(iosDirectory, 'Podfile'))) {
|
|
38
38
|
devkit_1.logger.info('Skipping `pod install`');
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
@@ -49,10 +49,11 @@ function podInstall(iosDirectory, options = {
|
|
|
49
49
|
useBundler: false,
|
|
50
50
|
}) {
|
|
51
51
|
try {
|
|
52
|
-
if ((0,
|
|
52
|
+
if ((0, node_fs_1.existsSync)((0, path_1.join)(iosDirectory, '.xcode.env'))) {
|
|
53
53
|
(0, child_process_1.execSync)('touch .xcode.env', {
|
|
54
54
|
cwd: iosDirectory,
|
|
55
55
|
stdio: 'inherit',
|
|
56
|
+
windowsHide: true,
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
const podCommand = [
|
|
@@ -63,6 +64,7 @@ function podInstall(iosDirectory, options = {
|
|
|
63
64
|
(0, child_process_1.execSync)(podCommand, {
|
|
64
65
|
cwd: iosDirectory,
|
|
65
66
|
stdio: 'inherit',
|
|
67
|
+
windowsHide: true,
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
catch (e) {
|
|
@@ -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
|
}
|