@nx/react-native 23.2.0-beta.0 → 23.2.0-beta.10
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/dist/plugins/plugin.js +2 -4
- package/dist/src/executors/sync-deps/sync-deps.impl.d.ts +1 -1
- package/dist/src/generators/application/application.js +0 -1
- package/dist/src/generators/application/lib/add-e2e.js +2 -1
- package/dist/src/generators/application/lib/create-application-files.js +3 -3
- package/dist/src/generators/application/lib/normalize-options.d.ts +2 -0
- package/dist/src/generators/application/lib/normalize-options.js +4 -0
- package/dist/src/generators/application/schema.d.ts +7 -3
- package/dist/src/generators/application/schema.json +15 -5
- package/dist/src/generators/library/lib/normalize-options.d.ts +2 -0
- package/dist/src/generators/library/lib/normalize-options.js +4 -0
- package/dist/src/generators/library/schema.d.ts +6 -2
- package/dist/src/generators/library/schema.json +10 -6
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
- package/dist/src/utils/add-linting.d.ts +7 -2
- package/dist/src/utils/add-linting.js +11 -9
- package/package.json +9 -9
package/dist/plugins/plugin.js
CHANGED
|
@@ -6,13 +6,11 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
10
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
11
9
|
exports.createNodes = [
|
|
12
10
|
'**/app.{json,config.js,config.ts}',
|
|
13
11
|
async (configFiles, options, context) => {
|
|
14
|
-
const optionsHash = (0,
|
|
15
|
-
const cachePath = (0, path_1.join)(
|
|
12
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
13
|
+
const cachePath = (0, path_1.join)(internal_1.workspaceDataDirectory, `react-native-${optionsHash}.hash`);
|
|
16
14
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
17
15
|
const lockFileName = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
18
16
|
const normalizedOptions = normalizeOptions(options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutorContext, ProjectGraph } from '@nx/devkit';
|
|
2
2
|
import { ReactNativeSyncDepsOptions } from './schema';
|
|
3
|
-
import { PackageJson } from 'nx/
|
|
3
|
+
import { PackageJson } from '@nx/devkit/internal';
|
|
4
4
|
export interface ReactNativeSyncDepsOutput {
|
|
5
5
|
success: boolean;
|
|
6
6
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
4
|
const internal_1 = require("@nx/react/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
6
7
|
const versions_1 = require("../../../utils/versions");
|
|
7
8
|
async function addE2e(host, options) {
|
|
8
9
|
switch (options.e2eTestRunner) {
|
|
@@ -34,7 +35,7 @@ async function addE2e(host, options) {
|
|
|
34
35
|
appDisplayName: options.displayName,
|
|
35
36
|
appName: options.name,
|
|
36
37
|
framework: 'react-native',
|
|
37
|
-
|
|
38
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
38
39
|
skipFormat: true,
|
|
39
40
|
});
|
|
40
41
|
case 'none':
|
|
@@ -4,11 +4,11 @@ exports.createApplicationFiles = createApplicationFiles;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const
|
|
7
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
8
8
|
async function createApplicationFiles(host, options) {
|
|
9
|
-
const onBoardingStatus = await (0,
|
|
9
|
+
const onBoardingStatus = await (0, internal_1.createNxCloudOnboardingURLForWelcomeApp)(host, options.nxCloudToken);
|
|
10
10
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
11
|
-
(await (0,
|
|
11
|
+
(await (0, internal_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
12
12
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), options.appProjectRoot, {
|
|
13
13
|
...options,
|
|
14
14
|
entryFileIos: 'src/main',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
|
+
import type { LinterType } from '@nx/js';
|
|
3
4
|
export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
|
|
5
|
+
linter: LinterType;
|
|
4
6
|
className: string;
|
|
5
7
|
fileName: string;
|
|
6
8
|
projectName: string;
|
|
@@ -29,6 +29,10 @@ async function normalizeOptions(host, options) {
|
|
|
29
29
|
const entryFile = options.js ? 'src/main.js' : 'src/main.tsx';
|
|
30
30
|
return {
|
|
31
31
|
...options,
|
|
32
|
+
// Resolved after the spread: `undefined` is falsy, so the ESLint arm in
|
|
33
|
+
// add-linting would still run while the `=== 'eslint'` tsconfig excludes
|
|
34
|
+
// downstream are skipped.
|
|
35
|
+
linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
|
|
32
36
|
name: projectNames.projectSimpleName,
|
|
33
37
|
className,
|
|
34
38
|
fileName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface Schema {
|
|
4
4
|
directory: string;
|
|
@@ -10,7 +10,11 @@ export interface Schema {
|
|
|
10
10
|
unitTestRunner: 'jest' | 'none'; // default is jest
|
|
11
11
|
classComponent?: boolean;
|
|
12
12
|
js?: boolean;
|
|
13
|
-
linter
|
|
13
|
+
linter?: LinterType;
|
|
14
|
+
enableTypedLinting?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
17
|
+
*/
|
|
14
18
|
setParserOptionsProject?: boolean;
|
|
15
19
|
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is cypress
|
|
16
20
|
bundler: 'webpack' | 'vite'; // default is webpack
|
|
@@ -20,6 +24,6 @@ export interface Schema {
|
|
|
20
24
|
addPlugin?: boolean;
|
|
21
25
|
nxCloudToken?: string;
|
|
22
26
|
useTsSolution?: boolean;
|
|
23
|
-
formatter?: 'prettier' | 'none';
|
|
27
|
+
formatter?: 'prettier' | 'oxfmt' | 'none';
|
|
24
28
|
useProjectJson?: boolean;
|
|
25
29
|
}
|
|
@@ -41,12 +41,16 @@
|
|
|
41
41
|
"x-priority": "internal"
|
|
42
42
|
},
|
|
43
43
|
"linter": {
|
|
44
|
-
"description": "The tool to use for running lint checks.",
|
|
44
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
45
45
|
"type": "string",
|
|
46
|
-
"enum": ["eslint", "none"],
|
|
47
|
-
"default": "none",
|
|
46
|
+
"enum": ["eslint", "oxlint", "none"],
|
|
48
47
|
"x-priority": "important"
|
|
49
48
|
},
|
|
49
|
+
"formatter": {
|
|
50
|
+
"description": "The tool to use for code formatting.",
|
|
51
|
+
"type": "string",
|
|
52
|
+
"enum": ["none", "prettier", "oxfmt"]
|
|
53
|
+
},
|
|
50
54
|
"unitTestRunner": {
|
|
51
55
|
"type": "string",
|
|
52
56
|
"enum": ["jest", "none"],
|
|
@@ -64,11 +68,17 @@
|
|
|
64
68
|
"description": "Generate JavaScript files rather than TypeScript files",
|
|
65
69
|
"default": false
|
|
66
70
|
},
|
|
67
|
-
"
|
|
71
|
+
"enableTypedLinting": {
|
|
68
72
|
"type": "boolean",
|
|
69
|
-
"description": "Whether
|
|
73
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
70
74
|
"default": false
|
|
71
75
|
},
|
|
76
|
+
"setParserOptionsProject": {
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
79
|
+
"default": false,
|
|
80
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
81
|
+
},
|
|
72
82
|
"e2eTestRunner": {
|
|
73
83
|
"description": "Adds the specified e2e test runner.",
|
|
74
84
|
"type": "string",
|
|
@@ -22,6 +22,10 @@ async function normalizeOptions(host, options) {
|
|
|
22
22
|
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
23
23
|
const normalized = {
|
|
24
24
|
...options,
|
|
25
|
+
// Resolved in the literal so the type guarantees it: `undefined` is falsy,
|
|
26
|
+
// so the ESLint arm would still run while the `=== 'eslint'` tsconfig
|
|
27
|
+
// excludes below are skipped.
|
|
28
|
+
linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
|
|
25
29
|
fileName: projectName,
|
|
26
30
|
routePath: `/${projectNames.projectSimpleName}`,
|
|
27
31
|
name: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject
|
|
@@ -10,12 +10,16 @@ export interface Schema {
|
|
|
10
10
|
skipFormat: boolean;
|
|
11
11
|
tags?: string;
|
|
12
12
|
unitTestRunner: 'jest' | 'none';
|
|
13
|
-
linter
|
|
13
|
+
linter?: LinterType;
|
|
14
14
|
publishable?: boolean;
|
|
15
15
|
buildable?: boolean;
|
|
16
16
|
importPath?: string;
|
|
17
17
|
js?: boolean;
|
|
18
18
|
strict?: boolean;
|
|
19
|
+
enableTypedLinting?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
22
|
+
*/
|
|
19
23
|
setParserOptionsProject?: boolean;
|
|
20
24
|
skipPackageJson?: boolean; //default is false
|
|
21
25
|
addPlugin?: boolean;
|
|
@@ -29,11 +29,9 @@
|
|
|
29
29
|
"x-priority": "important"
|
|
30
30
|
},
|
|
31
31
|
"linter": {
|
|
32
|
-
"description": "The tool to use for running lint checks.",
|
|
32
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
33
33
|
"type": "string",
|
|
34
|
-
"enum": ["eslint", "none"],
|
|
35
|
-
"default": "none",
|
|
36
|
-
"x-prompt": "Which linter would you like to use?",
|
|
34
|
+
"enum": ["eslint", "oxlint", "none"],
|
|
37
35
|
"x-priority": "important"
|
|
38
36
|
},
|
|
39
37
|
"unitTestRunner": {
|
|
@@ -84,11 +82,17 @@
|
|
|
84
82
|
"description": "Whether to enable tsconfig strict mode or not.",
|
|
85
83
|
"default": true
|
|
86
84
|
},
|
|
87
|
-
"
|
|
85
|
+
"enableTypedLinting": {
|
|
88
86
|
"type": "boolean",
|
|
89
|
-
"description": "Whether
|
|
87
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
90
88
|
"default": false
|
|
91
89
|
},
|
|
90
|
+
"setParserOptionsProject": {
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
93
|
+
"default": false,
|
|
94
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
95
|
+
},
|
|
92
96
|
"skipPackageJson": {
|
|
93
97
|
"description": "Do not add dependencies to `package.json`.",
|
|
94
98
|
"type": "boolean",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#### Rename `createNodesV2` imports to `createNodes`
|
|
2
|
+
|
|
3
|
+
`@nx/react-native` renamed its primary inferred-plugin export from `createNodesV2` to `createNodes`. The `createNodesV2` name is preserved as a deprecated alias for now, but new code should use `createNodes`.
|
|
4
|
+
|
|
5
|
+
This migration scans every `.ts`, `.tsx`, `.cts`, and `.mts` file in your workspace and rewrites named imports and re-exports of `createNodesV2` from `@nx/react-native/plugin` to `createNodes`.
|
|
6
|
+
|
|
7
|
+
#### Sample Code Changes
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { createNodesV2 } from '@nx/react-native/plugin';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### After
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createNodes } from '@nx/react-native/plugin';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Aliases are preserved (`createNodesV2 as cn` becomes `createNodes as cn`), and if a file already imports both names (`{ createNodes, createNodesV2 }`) the redundant binding is dropped.
|
|
22
|
+
|
|
23
|
+
#### What is not rewritten
|
|
24
|
+
|
|
25
|
+
Only static `import`/`export` named bindings from `@nx/react-native/plugin` are rewritten. Namespace imports, dynamic `import(...)`, `require(...)` destructuring, and property access such as `plugin.createNodesV2` are left untouched — they keep working through the `createNodesV2` runtime alias. Update those by hand if you want to drop the deprecated name everywhere.
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinterType } from '@nx/js';
|
|
2
2
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
3
3
|
interface NormalizedSchema {
|
|
4
|
-
linter?:
|
|
4
|
+
linter?: LinterType;
|
|
5
5
|
projectName: string;
|
|
6
6
|
projectRoot: string;
|
|
7
|
+
enableTypedLinting?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
10
|
+
*/
|
|
7
11
|
setParserOptionsProject?: boolean;
|
|
8
12
|
tsConfigPaths: string[];
|
|
13
|
+
unitTestRunner?: string;
|
|
9
14
|
skipPackageJson?: boolean;
|
|
10
15
|
addPlugin?: boolean;
|
|
11
16
|
buildable?: boolean;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
|
-
const eslint_1 = require("@nx/eslint");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const react_1 = require("@nx/react");
|
|
7
6
|
const internal_1 = require("@nx/eslint/internal");
|
|
7
|
+
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
async function addLinting(host, options) {
|
|
9
|
-
if (options.linter === 'none') {
|
|
10
|
-
return () => { };
|
|
11
|
-
}
|
|
12
9
|
const tasks = [];
|
|
13
|
-
|
|
10
|
+
tasks.push(await (0, internal_2.addLintingToProject)(host, {
|
|
11
|
+
oxlintPlugins: ['react', 'react-perf'],
|
|
14
12
|
linter: options.linter,
|
|
15
13
|
project: options.projectName,
|
|
16
14
|
tsConfigPaths: options.tsConfigPaths,
|
|
17
|
-
|
|
15
|
+
unitTestRunner: options.unitTestRunner,
|
|
18
16
|
skipPackageJson: options.skipPackageJson,
|
|
19
|
-
|
|
17
|
+
enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
|
|
20
18
|
addPlugin: options.addPlugin,
|
|
21
19
|
addPackageJsonDependencyChecks: options.buildable,
|
|
22
|
-
});
|
|
23
|
-
|
|
20
|
+
}));
|
|
21
|
+
// Everything below configures ESLint — predefined configs, `extends`, ignore
|
|
22
|
+
// entries — which have no equivalent in other linters.
|
|
23
|
+
if (options.linter && options.linter !== 'eslint') {
|
|
24
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
25
|
+
}
|
|
24
26
|
// Add ignored dependencies and files to dependency-checks rule
|
|
25
27
|
if ((0, internal_1.isEslintConfigSupported)(host)) {
|
|
26
28
|
(0, internal_1.updateOverrideInLintConfig)(host, options.projectRoot, (override) => Boolean(override.rules?.['@nx/dependency-checks']), (override) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.10",
|
|
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": [
|
|
@@ -62,11 +62,10 @@
|
|
|
62
62
|
"tinyglobby": "^0.2.12",
|
|
63
63
|
"tsconfig-paths": "^4.1.2",
|
|
64
64
|
"tslib": "^2.3.0",
|
|
65
|
-
"@nx/devkit": "23.2.0-beta.
|
|
66
|
-
"@nx/js": "23.2.0-beta.
|
|
67
|
-
"@nx/eslint": "23.2.0-beta.
|
|
68
|
-
"@nx/
|
|
69
|
-
"@nx/react": "23.2.0-beta.0"
|
|
65
|
+
"@nx/devkit": "23.2.0-beta.10",
|
|
66
|
+
"@nx/js": "23.2.0-beta.10",
|
|
67
|
+
"@nx/eslint": "23.2.0-beta.10",
|
|
68
|
+
"@nx/react": "23.2.0-beta.10"
|
|
70
69
|
},
|
|
71
70
|
"peerDependencies": {
|
|
72
71
|
"react-native": ">=0.83.0 <0.85.0",
|
|
@@ -79,11 +78,12 @@
|
|
|
79
78
|
}
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
|
-
"nx": "23.2.0-beta.
|
|
81
|
+
"@nx/webpack": "23.2.0-beta.10",
|
|
82
|
+
"nx": "23.2.0-beta.10"
|
|
83
83
|
},
|
|
84
84
|
"optionalDependencies": {
|
|
85
|
-
"@nx/detox": "23.2.0-beta.
|
|
86
|
-
"@nx/rollup": "23.2.0-beta.
|
|
85
|
+
"@nx/detox": "23.2.0-beta.10",
|
|
86
|
+
"@nx/rollup": "23.2.0-beta.10"
|
|
87
87
|
},
|
|
88
88
|
"executors": "./executors.json",
|
|
89
89
|
"ng-update": {
|