@nx/react-native 0.0.0-pr-31936-35c1f02 → 0.0.0-pr-31936-1238995
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "0.0.0-pr-31936-
|
|
3
|
+
"version": "0.0.0-pr-31936-1238995",
|
|
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-31936-
|
|
39
|
-
"@nx/jest": "0.0.0-pr-31936-
|
|
40
|
-
"@nx/js": "0.0.0-pr-31936-
|
|
41
|
-
"@nx/eslint": "0.0.0-pr-31936-
|
|
42
|
-
"@nx/react": "0.0.0-pr-31936-
|
|
43
|
-
"@nx/workspace": "0.0.0-pr-31936-
|
|
38
|
+
"@nx/devkit": "0.0.0-pr-31936-1238995",
|
|
39
|
+
"@nx/jest": "0.0.0-pr-31936-1238995",
|
|
40
|
+
"@nx/js": "0.0.0-pr-31936-1238995",
|
|
41
|
+
"@nx/eslint": "0.0.0-pr-31936-1238995",
|
|
42
|
+
"@nx/react": "0.0.0-pr-31936-1238995",
|
|
43
|
+
"@nx/workspace": "0.0.0-pr-31936-1238995"
|
|
44
44
|
},
|
|
45
45
|
"executors": "./executors.json",
|
|
46
46
|
"ng-update": {
|
|
@@ -69,22 +69,8 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
69
69
|
tasks.push(e2eTask);
|
|
70
70
|
const chmodTaskGradlewTask = (0, chmod_android_gradle_files_1.chmodAndroidGradlewFilesTask)((0, devkit_1.joinPathFragments)(host.root, options.androidProjectRoot));
|
|
71
71
|
tasks.push(chmodTaskGradlewTask);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const projectPackageJsonPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json');
|
|
75
|
-
const workspacePackageJson = (0, devkit_1.readJson)(host, 'package.json');
|
|
76
|
-
const projectPackageJson = (0, devkit_1.readJson)(host, projectPackageJsonPath);
|
|
77
|
-
await (0, sync_deps_impl_1.syncDeps)(options.name, projectPackageJson, projectPackageJsonPath, workspacePackageJson);
|
|
78
|
-
tasks.push(podInstallTask);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
devkit_1.output.log({
|
|
82
|
-
title: 'Skip `pod install`',
|
|
83
|
-
bodyLines: [
|
|
84
|
-
`run 'nx run ${options.name}:pod-install' to install native modules before running iOS app`,
|
|
85
|
-
],
|
|
86
|
-
});
|
|
87
|
-
}
|
|
72
|
+
tasks.push(addSyncDepsTask(host, options));
|
|
73
|
+
tasks.push(addPodInstallTask(host, options));
|
|
88
74
|
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.appProjectRoot, 'tsconfig.app.json', {
|
|
89
75
|
jsx: 'react-jsx',
|
|
90
76
|
module: 'esnext',
|
|
@@ -103,4 +89,25 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
103
89
|
});
|
|
104
90
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
105
91
|
}
|
|
92
|
+
function addSyncDepsTask(host, options) {
|
|
93
|
+
const projectPackageJsonPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json');
|
|
94
|
+
return async () => {
|
|
95
|
+
const workspacePackageJson = (0, devkit_1.readJson)(host, 'package.json');
|
|
96
|
+
const projectPackageJson = (0, devkit_1.readJson)(host, projectPackageJsonPath);
|
|
97
|
+
await (0, sync_deps_impl_1.syncDeps)(options.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function addPodInstallTask(host, options) {
|
|
101
|
+
const podInstallTask = (0, pod_install_task_1.runPodInstall)((0, devkit_1.joinPathFragments)(host.root, options.iosProjectRoot));
|
|
102
|
+
if (options.install) {
|
|
103
|
+
return podInstallTask;
|
|
104
|
+
}
|
|
105
|
+
devkit_1.output.log({
|
|
106
|
+
title: 'Skip `pod install`',
|
|
107
|
+
bodyLines: [
|
|
108
|
+
`run 'nx run ${options.name}:pod-install' to install native modules before running iOS app`,
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
return () => { };
|
|
112
|
+
}
|
|
106
113
|
exports.default = reactNativeApplicationGenerator;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { TargetConfiguration } from '@nx/devkit';
|
|
1
|
+
import { TargetConfiguration, 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(options: NormalizedSchema): TargetConfiguration;
|
|
5
|
+
export declare function createBuildTarget(tree: Tree, options: NormalizedSchema): TargetConfiguration;
|
|
6
6
|
export declare function createServeTarget(options: NormalizedSchema): TargetConfiguration;
|
|
7
|
-
export declare function createNxWebpackPluginOptions(options: NormalizedSchema): WithNxOptions & WithReactOptions;
|
|
7
|
+
export declare function createNxWebpackPluginOptions(tree: Tree, options: NormalizedSchema): WithNxOptions & WithReactOptions;
|
|
8
|
+
export declare function determineTsConfig(tree: Tree, options: NormalizedSchema): "tsconfig.app.json" | "tsconfig.lib.json" | "tsconfig.json";
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createBuildTarget = createBuildTarget;
|
|
4
4
|
exports.createServeTarget = createServeTarget;
|
|
5
5
|
exports.createNxWebpackPluginOptions = createNxWebpackPluginOptions;
|
|
6
|
+
exports.determineTsConfig = determineTsConfig;
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
function createBuildTarget(options) {
|
|
8
|
+
function createBuildTarget(tree, options) {
|
|
8
9
|
return {
|
|
9
10
|
executor: '@nx/webpack:webpack',
|
|
10
11
|
outputs: ['{options.outputPath}'],
|
|
@@ -15,7 +16,7 @@ function createBuildTarget(options) {
|
|
|
15
16
|
index: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/index.html'),
|
|
16
17
|
baseHref: '/',
|
|
17
18
|
main: (0, devkit_1.joinPathFragments)(options.projectRoot, `src/main-web.tsx`),
|
|
18
|
-
tsConfig: (0, devkit_1.joinPathFragments)(options.projectRoot,
|
|
19
|
+
tsConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, determineTsConfig(tree, options)),
|
|
19
20
|
assets: [
|
|
20
21
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src/favicon.ico'),
|
|
21
22
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src/assets'),
|
|
@@ -59,7 +60,7 @@ function createServeTarget(options) {
|
|
|
59
60
|
},
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
|
-
function createNxWebpackPluginOptions(options) {
|
|
63
|
+
function createNxWebpackPluginOptions(tree, options) {
|
|
63
64
|
return {
|
|
64
65
|
target: 'web',
|
|
65
66
|
compiler: 'babel',
|
|
@@ -67,8 +68,18 @@ function createNxWebpackPluginOptions(options) {
|
|
|
67
68
|
index: './src/index.html',
|
|
68
69
|
baseHref: '/',
|
|
69
70
|
main: `./src/main-web.tsx`,
|
|
70
|
-
tsConfig:
|
|
71
|
+
tsConfig: determineTsConfig(tree, options),
|
|
71
72
|
assets: ['./src/favicon.ico', './src/assets'],
|
|
72
73
|
styles: [],
|
|
73
74
|
};
|
|
74
75
|
}
|
|
76
|
+
function determineTsConfig(tree, options) {
|
|
77
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
78
|
+
const appJson = (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.app.json');
|
|
79
|
+
if (tree.exists(appJson))
|
|
80
|
+
return 'tsconfig.app.json';
|
|
81
|
+
const libJson = (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.lib.json');
|
|
82
|
+
if (tree.exists(libJson))
|
|
83
|
+
return 'tsconfig.lib.json';
|
|
84
|
+
return 'tsconfig.json';
|
|
85
|
+
}
|
|
@@ -26,8 +26,8 @@ async function webConfigurationGenerator(tree, options) {
|
|
|
26
26
|
tasks.push(installTask);
|
|
27
27
|
}
|
|
28
28
|
// apply webpack or vite init generator
|
|
29
|
-
const
|
|
30
|
-
tasks.push(
|
|
29
|
+
const bundlerTasks = await addBundlerConfiguration(tree, normalizedSchema);
|
|
30
|
+
tasks.push(...bundlerTasks);
|
|
31
31
|
// create files for webpack and vite config, index.html
|
|
32
32
|
if (normalizedSchema.bundler === 'vite') {
|
|
33
33
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/base-vite'), normalizedSchema.projectRoot, { ...normalizedSchema, tmpl: '' });
|
|
@@ -37,7 +37,7 @@ async function webConfigurationGenerator(tree, options) {
|
|
|
37
37
|
...normalizedSchema,
|
|
38
38
|
tmpl: '',
|
|
39
39
|
webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)
|
|
40
|
-
? (0, webpack_targets_1.createNxWebpackPluginOptions)(normalizedSchema)
|
|
40
|
+
? (0, webpack_targets_1.createNxWebpackPluginOptions)(tree, normalizedSchema)
|
|
41
41
|
: null,
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -69,25 +69,31 @@ async function addBundlerConfiguration(tree, normalizedSchema) {
|
|
|
69
69
|
compiler: 'babel',
|
|
70
70
|
skipFormat: true,
|
|
71
71
|
});
|
|
72
|
-
return viteTask;
|
|
72
|
+
return [viteTask];
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
+
let tasks = [];
|
|
75
76
|
const { webpackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/webpack', versions_1.nxVersion);
|
|
76
77
|
const webpackInitTask = await webpackInitGenerator(tree, {
|
|
77
78
|
...normalizedSchema,
|
|
78
79
|
skipFormat: true,
|
|
79
80
|
skipPackageJson: normalizedSchema.skipPackageJson,
|
|
80
81
|
});
|
|
82
|
+
tasks.push(webpackInitTask);
|
|
83
|
+
if (!normalizedSchema.skipPackageJson) {
|
|
84
|
+
const { ensureDependencies } = await Promise.resolve().then(() => require('@nx/webpack/src/utils/ensure-dependencies'));
|
|
85
|
+
tasks.push(ensureDependencies(tree, { uiFramework: 'react' }));
|
|
86
|
+
}
|
|
81
87
|
if (!(0, has_webpack_plugin_1.hasWebpackPlugin)(tree)) {
|
|
82
88
|
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, normalizedSchema.project);
|
|
83
89
|
projectConfiguration.targets = {
|
|
84
90
|
...projectConfiguration.targets,
|
|
85
|
-
build: (0, webpack_targets_1.createBuildTarget)(normalizedSchema),
|
|
91
|
+
build: (0, webpack_targets_1.createBuildTarget)(tree, normalizedSchema),
|
|
86
92
|
serve: (0, webpack_targets_1.createServeTarget)(normalizedSchema),
|
|
87
93
|
};
|
|
88
94
|
(0, devkit_1.updateProjectConfiguration)(tree, normalizedSchema.project, projectConfiguration);
|
|
89
95
|
}
|
|
90
|
-
return
|
|
96
|
+
return tasks;
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
exports.default = webConfigurationGenerator;
|