@nx/react-native 24.0.0-pr.37405.acdaf31 → 24.0.0-rc.0
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/metro-reporter.d.ts +1 -0
- package/dist/plugins/metro-reporter.js +50 -0
- package/dist/plugins/plugin.js +20 -5
- package/dist/src/generators/application/application.js +2 -3
- package/dist/src/generators/application/lib/add-e2e.js +0 -2
- package/dist/src/generators/application/lib/add-project.js +1 -83
- package/dist/src/generators/application/lib/normalize-options.js +0 -4
- package/dist/src/generators/application/schema.d.ts +0 -5
- package/dist/src/generators/application/schema.json +0 -6
- package/dist/src/generators/convert-to-inferred/lib/create-process-options.d.ts +2 -2
- package/dist/src/generators/convert-to-inferred/lib/create-process-options.js +2 -2
- package/dist/src/generators/init/init.js +44 -53
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/generators/library/lib/normalize-options.js +0 -5
- package/dist/src/generators/library/library.js +2 -3
- package/dist/src/generators/library/schema.d.ts +0 -5
- package/dist/src/generators/library/schema.json +0 -6
- package/dist/src/generators/web-configuration/files/base-vite/vite.config.mts__tmpl__ +6 -5
- package/dist/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +2 -51
- package/dist/src/generators/web-configuration/lib/webpack-targets.d.ts +1 -3
- package/dist/src/generators/web-configuration/lib/webpack-targets.js +0 -57
- package/dist/src/generators/web-configuration/web-configuration.js +9 -18
- package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +30 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +68 -0
- package/dist/src/utils/add-jest.d.ts +1 -1
- package/dist/src/utils/add-jest.js +1 -2
- package/dist/src/utils/add-linting.d.ts +0 -5
- package/dist/src/utils/add-linting.js +1 -2
- package/dist/src/utils/chmod-android-gradle-files.d.ts +0 -1
- package/dist/src/utils/chmod-android-gradle-files.js +0 -1
- package/dist/src/utils/pod-install-task.d.ts +0 -6
- package/dist/src/utils/pod-install-task.js +0 -1
- package/dist/src/utils/versions.d.ts +1 -0
- package/dist/src/utils/versions.js +2 -1
- package/executors.json +0 -40
- package/migrations.json +7 -0
- package/package.json +9 -9
- package/dist/src/executors/build-android/build-android.impl.d.ts +0 -6
- package/dist/src/executors/build-android/build-android.impl.js +0 -53
- package/dist/src/executors/build-android/schema.d.ts +0 -13
- package/dist/src/executors/build-android/schema.json +0 -82
- package/dist/src/executors/build-ios/build-ios.impl.d.ts +0 -6
- package/dist/src/executors/build-ios/build-ios.impl.js +0 -60
- package/dist/src/executors/build-ios/schema.d.ts +0 -17
- package/dist/src/executors/build-ios/schema.json +0 -92
- package/dist/src/executors/bundle/bundle.impl.d.ts +0 -6
- package/dist/src/executors/bundle/bundle.impl.js +0 -61
- package/dist/src/executors/bundle/schema.d.ts +0 -16
- package/dist/src/executors/bundle/schema.json +0 -93
- package/dist/src/executors/pod-install/pod-install.impl.d.ts +0 -6
- package/dist/src/executors/pod-install/pod-install.impl.js +0 -13
- package/dist/src/executors/pod-install/schema.d.ts +0 -6
- package/dist/src/executors/pod-install/schema.json +0 -34
- package/dist/src/executors/run-android/run-android.impl.d.ts +0 -6
- package/dist/src/executors/run-android/run-android.impl.js +0 -71
- package/dist/src/executors/run-android/schema.d.ts +0 -12
- package/dist/src/executors/run-android/schema.json +0 -102
- package/dist/src/executors/run-ios/run-ios.impl.d.ts +0 -6
- package/dist/src/executors/run-ios/run-ios.impl.js +0 -70
- package/dist/src/executors/run-ios/schema.d.ts +0 -7
- package/dist/src/executors/run-ios/schema.json +0 -98
- package/dist/src/executors/start/lib/is-packager-running.d.ts +0 -1
- package/dist/src/executors/start/lib/is-packager-running.js +0 -13
- package/dist/src/executors/start/schema.d.ts +0 -7
- package/dist/src/executors/start/schema.json +0 -30
- package/dist/src/executors/start/start.impl.d.ts +0 -9
- package/dist/src/executors/start/start.impl.js +0 -91
- package/dist/src/executors/upgrade/schema.d.ts +0 -1
- package/dist/src/executors/upgrade/schema.json +0 -12
- package/dist/src/executors/upgrade/upgrade.impl.d.ts +0 -12
- package/dist/src/executors/upgrade/upgrade.impl.js +0 -51
- package/dist/src/utils/deprecation.d.ts +0 -2
- package/dist/src/utils/deprecation.js +0 -19
- package/dist/src/utils/get-cli-options.d.ts +0 -8
- package/dist/src/utils/get-cli-options.js +0 -32
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const diagnostics_channel_1 = require("diagnostics_channel");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const tls_1 = require("tls");
|
|
6
|
+
const { TerminalReporter } = require(resolveMetro(process.cwd()));
|
|
7
|
+
/**
|
|
8
|
+
* Metro's terminal reporter, which also reports the dev server's address to an
|
|
9
|
+
* Nx task whose readyWhen is `signal`. `react-native start` loads it through
|
|
10
|
+
* `--custom-log-reporter-path`.
|
|
11
|
+
*/
|
|
12
|
+
class NxMetroReporter extends TerminalReporter {
|
|
13
|
+
constructor(terminal) {
|
|
14
|
+
super(terminal);
|
|
15
|
+
this.secureByPort = new Map();
|
|
16
|
+
if (process.env.NX_READY_SIGNAL_SOCKET) {
|
|
17
|
+
// server_listening has no protocol, and Metro also serves HTTPS for a
|
|
18
|
+
// `server.tls` config. This channel publishes before that event fires.
|
|
19
|
+
(0, diagnostics_channel_1.subscribe)('tracing:net.server.listen:asyncEnd', (message) => {
|
|
20
|
+
const { server } = message;
|
|
21
|
+
const address = server.address();
|
|
22
|
+
if (address && typeof address === 'object') {
|
|
23
|
+
this.secureByPort.set(address.port, server instanceof tls_1.Server);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
update(event) {
|
|
29
|
+
super.update(event);
|
|
30
|
+
if (event.type !== 'server_listening' ||
|
|
31
|
+
!process.env.NX_READY_SIGNAL_SOCKET) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const { emitReadySignal } = require('@nx/devkit');
|
|
35
|
+
const { getListeningUrl } = require('@nx/devkit/internal');
|
|
36
|
+
const listening = event;
|
|
37
|
+
emitReadySignal(getListeningUrl(listening, this.secureByPort.get(listening.port) ??
|
|
38
|
+
process.argv.includes('--https')));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// The metro react-native start uses. This package does not depend on metro,
|
|
42
|
+
// so a plain require can fail or find another hoisted version.
|
|
43
|
+
function resolveMetro(projectRoot) {
|
|
44
|
+
const reactNative = (0, path_1.dirname)(require.resolve('react-native/package.json', { paths: [projectRoot] }));
|
|
45
|
+
const cliPlugin = (0, path_1.dirname)(require.resolve('@react-native/community-cli-plugin/package.json', {
|
|
46
|
+
paths: [reactNative],
|
|
47
|
+
}));
|
|
48
|
+
return require.resolve('metro', { paths: [cliPlugin] });
|
|
49
|
+
}
|
|
50
|
+
module.exports = NxMetroReporter;
|
package/dist/plugins/plugin.js
CHANGED
|
@@ -59,11 +59,7 @@ async function createNodesInternal(configFile, options, context, targetsCache, h
|
|
|
59
59
|
function buildReactNativeTargets(projectRoot, options, context) {
|
|
60
60
|
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
61
61
|
const targets = {
|
|
62
|
-
[options.startTargetName]:
|
|
63
|
-
command: `react-native start`,
|
|
64
|
-
continuous: true,
|
|
65
|
-
options: { cwd: projectRoot },
|
|
66
|
-
},
|
|
62
|
+
[options.startTargetName]: getStartTarget(projectRoot, context),
|
|
67
63
|
[options.podInstallTargetName]: {
|
|
68
64
|
command: `pod install`,
|
|
69
65
|
options: { cwd: (0, devkit_1.joinPathFragments)(projectRoot, 'ios') },
|
|
@@ -112,6 +108,25 @@ function buildReactNativeTargets(projectRoot, options, context) {
|
|
|
112
108
|
};
|
|
113
109
|
return targets;
|
|
114
110
|
}
|
|
111
|
+
const METRO_REPORTER_PATH = 'node_modules/@nx/react-native/dist/plugins/metro-reporter.js';
|
|
112
|
+
function getStartTarget(projectRoot, context) {
|
|
113
|
+
const target = {
|
|
114
|
+
command: `react-native start`,
|
|
115
|
+
continuous: true,
|
|
116
|
+
options: { cwd: projectRoot },
|
|
117
|
+
};
|
|
118
|
+
// react-native start fails on a missing reporter, as when the plugin is
|
|
119
|
+
// installed outside the root node_modules (e.g. .nx/installation)
|
|
120
|
+
if (!(0, fs_1.existsSync)((0, path_1.join)(context.workspaceRoot, METRO_REPORTER_PATH))) {
|
|
121
|
+
return target;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
...target,
|
|
125
|
+
// Relative to the task's cwd, so the graph holds no machine-specific path
|
|
126
|
+
command: `react-native start --custom-log-reporter-path ${(0, devkit_1.offsetFromRoot)(projectRoot)}${METRO_REPORTER_PATH}`,
|
|
127
|
+
readyWhen: { signal: true },
|
|
128
|
+
};
|
|
129
|
+
}
|
|
115
130
|
function getAppConfig(configFilePath, context) {
|
|
116
131
|
const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
|
|
117
132
|
return (0, internal_1.loadConfigFile)(resolvedPath);
|
|
@@ -22,7 +22,6 @@ const sync_deps_impl_1 = require("../../executors/sync-deps/sync-deps.impl");
|
|
|
22
22
|
const internal_2 = require("@nx/js/internal");
|
|
23
23
|
async function reactNativeApplicationGenerator(host, schema) {
|
|
24
24
|
return await reactNativeApplicationGeneratorInternal(host, {
|
|
25
|
-
addPlugin: false,
|
|
26
25
|
useProjectJson: true,
|
|
27
26
|
...schema,
|
|
28
27
|
});
|
|
@@ -30,7 +29,7 @@ async function reactNativeApplicationGenerator(host, schema) {
|
|
|
30
29
|
async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
31
30
|
(0, versions_1.assertSupportedReactNativeVersion)(host);
|
|
32
31
|
const tasks = [];
|
|
33
|
-
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.
|
|
32
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, schema.useTsSolution);
|
|
34
33
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
35
34
|
...schema,
|
|
36
35
|
skipFormat: true,
|
|
@@ -59,7 +58,7 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
59
58
|
],
|
|
60
59
|
});
|
|
61
60
|
tasks.push(lintTask);
|
|
62
|
-
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson,
|
|
61
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, 'tsconfig.app.json');
|
|
63
62
|
tasks.push(jestTask);
|
|
64
63
|
const webTask = await (0, web_configuration_1.webConfigurationGenerator)(host, {
|
|
65
64
|
...options,
|
|
@@ -3,7 +3,6 @@ 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");
|
|
7
6
|
const versions_1 = require("../../../utils/versions");
|
|
8
7
|
async function addE2e(host, options) {
|
|
9
8
|
switch (options.e2eTestRunner) {
|
|
@@ -35,7 +34,6 @@ async function addE2e(host, options) {
|
|
|
35
34
|
appDisplayName: options.displayName,
|
|
36
35
|
appName: options.name,
|
|
37
36
|
framework: 'react-native',
|
|
38
|
-
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
39
37
|
skipFormat: true,
|
|
40
38
|
});
|
|
41
39
|
case 'none':
|
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const deprecation_1 = require("../../../utils/deprecation");
|
|
6
5
|
function addProject(host, options) {
|
|
7
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
8
|
-
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
9
|
-
? p === '@nx/react-native/plugin'
|
|
10
|
-
: p.plugin === '@nx/react-native/plugin');
|
|
11
|
-
if (!hasPlugin) {
|
|
12
|
-
(0, deprecation_1.warnReactNativeExecutorGenerating)();
|
|
13
|
-
}
|
|
14
6
|
const project = {
|
|
15
7
|
root: options.appProjectRoot,
|
|
16
8
|
sourceRoot: `${options.appProjectRoot}/src`,
|
|
17
9
|
projectType: 'application',
|
|
18
|
-
targets:
|
|
10
|
+
targets: {},
|
|
19
11
|
tags: options.parsedTags,
|
|
20
12
|
};
|
|
21
13
|
const templatedPackageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'));
|
|
@@ -29,10 +21,6 @@ function addProject(host, options) {
|
|
|
29
21
|
if (options.projectName !== options.importPath) {
|
|
30
22
|
packageJson.nx = { name: options.projectName };
|
|
31
23
|
}
|
|
32
|
-
if (!hasPlugin) {
|
|
33
|
-
packageJson.nx ??= {};
|
|
34
|
-
packageJson.nx.targets = getTargets(options);
|
|
35
|
-
}
|
|
36
24
|
if (options.parsedTags?.length) {
|
|
37
25
|
packageJson.nx ??= {};
|
|
38
26
|
packageJson.nx.tags = options.parsedTags;
|
|
@@ -47,73 +35,3 @@ function addProject(host, options) {
|
|
|
47
35
|
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
48
36
|
}
|
|
49
37
|
}
|
|
50
|
-
function getTargets(options) {
|
|
51
|
-
const architect = {};
|
|
52
|
-
architect.start = {
|
|
53
|
-
executor: '@nx/react-native:start',
|
|
54
|
-
dependsOn: [],
|
|
55
|
-
options: {
|
|
56
|
-
port: 8081,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
architect['run-ios'] = {
|
|
60
|
-
executor: '@nx/react-native:run-ios',
|
|
61
|
-
dependsOn: [],
|
|
62
|
-
options: {},
|
|
63
|
-
};
|
|
64
|
-
architect['bundle-ios'] = {
|
|
65
|
-
executor: '@nx/react-native:bundle',
|
|
66
|
-
dependsOn: [],
|
|
67
|
-
outputs: ['{options.bundleOutput}'],
|
|
68
|
-
options: {
|
|
69
|
-
entryFile: options.entryFile,
|
|
70
|
-
platform: 'ios',
|
|
71
|
-
bundleOutput: `dist/${options.appProjectRoot}/ios/main.jsbundle`,
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
architect['run-android'] = {
|
|
75
|
-
executor: '@nx/react-native:run-android',
|
|
76
|
-
dependsOn: [],
|
|
77
|
-
options: {},
|
|
78
|
-
};
|
|
79
|
-
architect['build-android'] = {
|
|
80
|
-
executor: '@nx/react-native:build-android',
|
|
81
|
-
outputs: [
|
|
82
|
-
`{projectRoot}/android/app/build/outputs/bundle`,
|
|
83
|
-
`{projectRoot}/android/app/build/outputs/apk`,
|
|
84
|
-
],
|
|
85
|
-
dependsOn: [],
|
|
86
|
-
options: {},
|
|
87
|
-
};
|
|
88
|
-
architect['build-ios'] = {
|
|
89
|
-
executor: '@nx/react-native:build-ios',
|
|
90
|
-
outputs: ['{projectRoot}/ios/build/Build'],
|
|
91
|
-
dependsOn: [],
|
|
92
|
-
options: {},
|
|
93
|
-
};
|
|
94
|
-
architect['pod-install'] = {
|
|
95
|
-
executor: '@nx/react-native:pod-install',
|
|
96
|
-
dependsOn: ['sync-deps'],
|
|
97
|
-
outputs: ['{projectRoot}/ios/Pods', '{projectRoot}/ios/Podfile.lock'],
|
|
98
|
-
options: {},
|
|
99
|
-
};
|
|
100
|
-
architect.upgrade = {
|
|
101
|
-
executor: '@nx/react-native:upgrade',
|
|
102
|
-
options: {},
|
|
103
|
-
};
|
|
104
|
-
architect['bundle-android'] = {
|
|
105
|
-
executor: '@nx/react-native:bundle',
|
|
106
|
-
dependsOn: [],
|
|
107
|
-
outputs: ['{options.bundleOutput}'],
|
|
108
|
-
options: {
|
|
109
|
-
entryFile: options.entryFile,
|
|
110
|
-
platform: 'android',
|
|
111
|
-
bundleOutput: `dist/${options.appProjectRoot}/android/main.jsbundle`,
|
|
112
|
-
},
|
|
113
|
-
};
|
|
114
|
-
architect['sync-deps'] = {
|
|
115
|
-
executor: '@nx/react-native:sync-deps',
|
|
116
|
-
options: {},
|
|
117
|
-
};
|
|
118
|
-
return architect;
|
|
119
|
-
}
|
|
@@ -11,10 +11,6 @@ async function normalizeOptions(host, options) {
|
|
|
11
11
|
projectType: 'application',
|
|
12
12
|
directory: options.directory,
|
|
13
13
|
});
|
|
14
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
15
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
|
-
nxJson.useInferencePlugins !== false;
|
|
17
|
-
options.addPlugin ??= addPluginDefault;
|
|
18
14
|
const { className, fileName } = (0, devkit_1.names)(projectNames.projectSimpleName);
|
|
19
15
|
const iosProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'ios');
|
|
20
16
|
const androidProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'android');
|
|
@@ -12,16 +12,11 @@ export interface Schema {
|
|
|
12
12
|
js?: boolean;
|
|
13
13
|
linter?: LinterType;
|
|
14
14
|
enableTypedLinting?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
17
|
-
*/
|
|
18
|
-
setParserOptionsProject?: boolean;
|
|
19
15
|
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is cypress
|
|
20
16
|
bundler: 'webpack' | 'vite'; // default is webpack
|
|
21
17
|
install: boolean; // default is true
|
|
22
18
|
skipPackageJson?: boolean; //default is false
|
|
23
19
|
// Internal options
|
|
24
|
-
addPlugin?: boolean;
|
|
25
20
|
nxCloudToken?: string;
|
|
26
21
|
useTsSolution?: boolean;
|
|
27
22
|
formatter?: 'prettier' | 'oxfmt' | 'none';
|
|
@@ -73,12 +73,6 @@
|
|
|
73
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.",
|
|
74
74
|
"default": false
|
|
75
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
|
-
},
|
|
82
76
|
"e2eTestRunner": {
|
|
83
77
|
"description": "Adds the specified e2e test runner.",
|
|
84
78
|
"type": "string",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AggregatedLog } from '@nx/devkit/internal';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Maps options to CLI args the way the removed executors did, so converted
|
|
4
|
+
* targets run the same React Native CLI command.
|
|
5
5
|
*/
|
|
6
6
|
export declare function createProcessOptions(executorName: string, optionKeysToIgnore: string[], optionKeysInCamelName: string[]): (projectName: string, options: any, migrationLogs: AggregatedLog) => void;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createProcessOptions = createProcessOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Maps options to CLI args the way the removed executors did, so converted
|
|
7
|
+
* targets run the same React Native CLI command.
|
|
8
8
|
*/
|
|
9
9
|
function createProcessOptions(executorName, optionKeysToIgnore, optionKeysInCamelName) {
|
|
10
10
|
return (projectName, options, migrationLogs) => {
|
|
@@ -9,63 +9,54 @@ const plugin_1 = require("../../../plugins/plugin");
|
|
|
9
9
|
const versions_1 = require("../../utils/versions");
|
|
10
10
|
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
11
11
|
function reactNativeInitGenerator(host, schema) {
|
|
12
|
-
return reactNativeInitGeneratorInternal(host,
|
|
13
|
-
addPlugin: false,
|
|
14
|
-
...schema,
|
|
15
|
-
});
|
|
12
|
+
return reactNativeInitGeneratorInternal(host, schema);
|
|
16
13
|
}
|
|
17
14
|
async function reactNativeInitGeneratorInternal(host, schema) {
|
|
18
15
|
(0, versions_1.assertSupportedReactNativeVersion)(host);
|
|
19
16
|
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'sync-deps',
|
|
64
|
-
'react-native:sync-deps',
|
|
65
|
-
'react-native-sync-deps',
|
|
66
|
-
],
|
|
67
|
-
}, schema.updatePackageScripts);
|
|
68
|
-
}
|
|
17
|
+
await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react-native/plugin', plugin_1.createNodesV2, {
|
|
18
|
+
startTargetName: ['start', 'react-native:start', 'react-native-start'],
|
|
19
|
+
upgradeTargetName: [
|
|
20
|
+
'update',
|
|
21
|
+
'react-native:update',
|
|
22
|
+
'react-native-update',
|
|
23
|
+
],
|
|
24
|
+
bundleTargetName: [
|
|
25
|
+
'bundle',
|
|
26
|
+
'react-native:bundle',
|
|
27
|
+
'react-native-bundle',
|
|
28
|
+
],
|
|
29
|
+
podInstallTargetName: [
|
|
30
|
+
'pod-install',
|
|
31
|
+
'react-native:pod-install',
|
|
32
|
+
'react-native-pod-install',
|
|
33
|
+
],
|
|
34
|
+
runIosTargetName: [
|
|
35
|
+
'run-ios',
|
|
36
|
+
'react-native:run-ios',
|
|
37
|
+
'react-native-run-ios',
|
|
38
|
+
],
|
|
39
|
+
runAndroidTargetName: [
|
|
40
|
+
'run-android',
|
|
41
|
+
'react-native:run-android',
|
|
42
|
+
'react-native-run-android',
|
|
43
|
+
],
|
|
44
|
+
buildIosTargetName: [
|
|
45
|
+
'build-ios',
|
|
46
|
+
'react-native:build-ios',
|
|
47
|
+
'react-native-build-ios',
|
|
48
|
+
],
|
|
49
|
+
buildAndroidTargetName: [
|
|
50
|
+
'build-android',
|
|
51
|
+
'react-native:build-android',
|
|
52
|
+
'react-native-build-android',
|
|
53
|
+
],
|
|
54
|
+
syncDepsTargetName: [
|
|
55
|
+
'sync-deps',
|
|
56
|
+
'react-native:sync-deps',
|
|
57
|
+
'react-native-sync-deps',
|
|
58
|
+
],
|
|
59
|
+
}, schema.updatePackageScripts);
|
|
69
60
|
const tasks = [];
|
|
70
61
|
if (!schema.skipPackageJson) {
|
|
71
62
|
tasks.push(moveDependency(host));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
5
|
const internal_2 = require("@nx/js/internal");
|
|
7
6
|
async function normalizeOptions(host, options) {
|
|
@@ -12,10 +11,6 @@ async function normalizeOptions(host, options) {
|
|
|
12
11
|
directory: options.directory,
|
|
13
12
|
importPath: options.importPath,
|
|
14
13
|
});
|
|
15
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
16
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
|
-
nxJson.useInferencePlugins !== false;
|
|
18
|
-
options.addPlugin ??= addPluginDefault;
|
|
19
14
|
const parsedTags = options.tags
|
|
20
15
|
? options.tags.split(',').map((s) => s.trim())
|
|
21
16
|
: [];
|
|
@@ -18,7 +18,6 @@ const path_1 = require("path");
|
|
|
18
18
|
const versions_1 = require("../../utils/versions");
|
|
19
19
|
async function reactNativeLibraryGenerator(host, schema) {
|
|
20
20
|
return await reactNativeLibraryGeneratorInternal(host, {
|
|
21
|
-
addPlugin: false,
|
|
22
21
|
useProjectJson: true,
|
|
23
22
|
...schema,
|
|
24
23
|
});
|
|
@@ -26,7 +25,7 @@ async function reactNativeLibraryGenerator(host, schema) {
|
|
|
26
25
|
async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
27
26
|
(0, versions_1.assertSupportedReactNativeVersion)(host);
|
|
28
27
|
const tasks = [];
|
|
29
|
-
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host
|
|
28
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host);
|
|
30
29
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
31
30
|
...schema,
|
|
32
31
|
addTsPlugin,
|
|
@@ -58,7 +57,7 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
|
58
57
|
],
|
|
59
58
|
});
|
|
60
59
|
tasks.push(lintTask);
|
|
61
|
-
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson,
|
|
60
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson, 'tsconfig.lib.json');
|
|
62
61
|
tasks.push(jestTask);
|
|
63
62
|
const relativeCwd = (0, internal_1.getRelativeCwd)();
|
|
64
63
|
const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.js ? `${options.fileName}.js` : options.fileName);
|
|
@@ -17,11 +17,6 @@ export interface Schema {
|
|
|
17
17
|
js?: boolean;
|
|
18
18
|
strict?: boolean;
|
|
19
19
|
enableTypedLinting?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
22
|
-
*/
|
|
23
|
-
setParserOptionsProject?: boolean;
|
|
24
20
|
skipPackageJson?: boolean; //default is false
|
|
25
|
-
addPlugin?: boolean;
|
|
26
21
|
useProjectJson?: boolean;
|
|
27
22
|
}
|
|
@@ -87,12 +87,6 @@
|
|
|
87
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.",
|
|
88
88
|
"default": false
|
|
89
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
|
-
},
|
|
96
90
|
"skipPackageJson": {
|
|
97
91
|
"description": "Do not add dependencies to `package.json`.",
|
|
98
92
|
"type": "boolean",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineConfig, transformWithEsbuild } from 'vite';
|
|
2
2
|
import react from '@vitejs/plugin-react';
|
|
3
|
-
|
|
4
|
-
import { readFileSync } from 'fs';
|
|
3
|
+
<% if (!useNativeTsconfigPaths) { %>import tsconfigPaths from 'vite-tsconfig-paths';
|
|
4
|
+
<% } %>import { readFileSync } from 'fs';
|
|
5
5
|
|
|
6
6
|
const extensions = [
|
|
7
7
|
'.mjs',
|
|
@@ -37,7 +37,8 @@ export default defineConfig({
|
|
|
37
37
|
global: 'window',
|
|
38
38
|
},
|
|
39
39
|
resolve: {
|
|
40
|
-
|
|
40
|
+
<% if (useNativeTsconfigPaths) { %> tsconfigPaths: true,
|
|
41
|
+
<% } %> extensions,
|
|
41
42
|
alias: {
|
|
42
43
|
'react-native': 'react-native-web',
|
|
43
44
|
'react-native-svg': 'react-native-svg-web',
|
|
@@ -72,9 +73,9 @@ export default defineConfig({
|
|
|
72
73
|
loader: { '.js': 'jsx' },
|
|
73
74
|
},
|
|
74
75
|
},
|
|
75
|
-
plugins: [react()
|
|
76
|
+
plugins: [react()<% if (!useNativeTsconfigPaths) { %>, tsconfigPaths({ loose: true })<% } %>],
|
|
76
77
|
// Uncomment this if you are using workers.
|
|
77
78
|
// worker: {
|
|
78
|
-
// plugins:
|
|
79
|
+
// plugins: [],
|
|
79
80
|
// },
|
|
80
81
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
|
3
3
|
const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin');
|
|
4
4
|
|
|
@@ -27,56 +27,7 @@ module.exports = {
|
|
|
27
27
|
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
28
28
|
optimization: process.env['NODE_ENV'] === 'production',
|
|
29
29
|
}),
|
|
30
|
-
new NxReactWebpackPlugin(
|
|
31
|
-
// Uncomment this line if you don't want to use SVGR
|
|
32
|
-
// See: https://react-svgr.com/
|
|
33
|
-
// svgr: false
|
|
34
|
-
}),
|
|
30
|
+
new NxReactWebpackPlugin(),
|
|
35
31
|
],
|
|
36
32
|
};
|
|
37
|
-
<% } else { %>
|
|
38
|
-
const { composePlugins, withNx } = require('@nx/webpack');
|
|
39
|
-
const { withReact } = require('@nx/react');
|
|
40
33
|
|
|
41
|
-
// Nx plugins for webpack.
|
|
42
|
-
module.exports = composePlugins(
|
|
43
|
-
withNx(),
|
|
44
|
-
withReact({
|
|
45
|
-
// Uncomment this line if you don't want to use SVGR
|
|
46
|
-
// See: https://react-svgr.com/
|
|
47
|
-
// svgr: false
|
|
48
|
-
}),
|
|
49
|
-
(config) => {
|
|
50
|
-
// Update the webpack config as needed here.
|
|
51
|
-
// e.g. `config.plugins.push(new MyPlugin())`
|
|
52
|
-
|
|
53
|
-
config.output.clean = true;
|
|
54
|
-
config.resolve.alias = {
|
|
55
|
-
...config.resolve.alias ?? {},
|
|
56
|
-
'react-native$': 'react-native-web',
|
|
57
|
-
'react-native-svg': 'react-native-svg-web',
|
|
58
|
-
'@react-native/assets-registry/registry': 'react-native-web/dist/modules/AssetRegistry/index',
|
|
59
|
-
};
|
|
60
|
-
config.resolve.extensions = [
|
|
61
|
-
'.web.tsx',
|
|
62
|
-
'.web.ts',
|
|
63
|
-
'.web.jsx',
|
|
64
|
-
'.web.js',
|
|
65
|
-
...config.resolve.extensions,
|
|
66
|
-
];
|
|
67
|
-
config.module.rules.push({
|
|
68
|
-
test: /\.(js|jsx)$/,
|
|
69
|
-
include: /react-native-vector-icons/,
|
|
70
|
-
loader: 'babel-loader',
|
|
71
|
-
options: {
|
|
72
|
-
presets: [
|
|
73
|
-
'@babel/preset-env',
|
|
74
|
-
['@babel/preset-react', { runtime: 'automatic' }],
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return config;
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
<% } %>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
2
|
import type { WithReactOptions } from '@nx/react';
|
|
3
3
|
import type { WithNxOptions } from '@nx/webpack';
|
|
4
4
|
import { NormalizedSchema } from './normalize-schema';
|
|
5
|
-
export declare function createBuildTarget(tree: Tree, options: NormalizedSchema): TargetConfiguration;
|
|
6
|
-
export declare function createServeTarget(options: NormalizedSchema): TargetConfiguration;
|
|
7
5
|
export declare function createNxWebpackPluginOptions(tree: Tree, options: NormalizedSchema): WithNxOptions & WithReactOptions;
|
|
8
6
|
export declare function determineTsConfig(tree: Tree, options: NormalizedSchema): "tsconfig.app.json" | "tsconfig.json" | "tsconfig.lib.json";
|