@nx/react-native 20.3.1 → 20.3.3
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/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "20.3.
|
|
3
|
+
"version": "20.3.3",
|
|
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": "20.3.
|
|
40
|
-
"@nx/jest": "20.3.
|
|
41
|
-
"@nx/js": "20.3.
|
|
42
|
-
"@nx/eslint": "20.3.
|
|
43
|
-
"@nx/react": "20.3.
|
|
44
|
-
"@nx/workspace": "20.3.
|
|
39
|
+
"@nx/devkit": "20.3.3",
|
|
40
|
+
"@nx/jest": "20.3.3",
|
|
41
|
+
"@nx/js": "20.3.3",
|
|
42
|
+
"@nx/eslint": "20.3.3",
|
|
43
|
+
"@nx/react": "20.3.3",
|
|
44
|
+
"@nx/workspace": "20.3.3"
|
|
45
45
|
},
|
|
46
46
|
"executors": "./executors.json",
|
|
47
47
|
"ng-update": {
|
|
@@ -18,6 +18,7 @@ const add_e2e_1 = require("./lib/add-e2e");
|
|
|
18
18
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
19
19
|
const sync_deps_impl_1 = require("../../executors/sync-deps/sync-deps.impl");
|
|
20
20
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
21
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
21
22
|
async function reactNativeApplicationGenerator(host, schema) {
|
|
22
23
|
return await reactNativeApplicationGeneratorInternal(host, {
|
|
23
24
|
addPlugin: false,
|
|
@@ -91,6 +92,7 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
91
92
|
if (options.useTsSolution) {
|
|
92
93
|
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
93
94
|
}
|
|
95
|
+
(0, sort_fields_1.sortPackageJsonFields)(host, options.appProjectRoot);
|
|
94
96
|
if (!options.skipFormat) {
|
|
95
97
|
await (0, devkit_1.formatFiles)(host);
|
|
96
98
|
}
|
|
@@ -13,6 +13,7 @@ const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
|
13
13
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
14
14
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
15
|
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
16
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
16
17
|
async function reactNativeLibraryGenerator(host, schema) {
|
|
17
18
|
return await reactNativeLibraryGeneratorInternal(host, {
|
|
18
19
|
addPlugin: false,
|
|
@@ -68,6 +69,7 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
|
68
69
|
if (options.isUsingTsSolutionConfig) {
|
|
69
70
|
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
70
71
|
}
|
|
72
|
+
(0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
71
73
|
if (!options.skipFormat) {
|
|
72
74
|
await (0, devkit_1.formatFiles)(host);
|
|
73
75
|
}
|
|
@@ -88,17 +90,12 @@ async function addProject(host, options) {
|
|
|
88
90
|
tags: options.parsedTags,
|
|
89
91
|
targets: {},
|
|
90
92
|
};
|
|
93
|
+
const packageJsonPath = (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json');
|
|
91
94
|
if (options.isUsingTsSolutionConfig) {
|
|
92
|
-
|
|
93
|
-
? options.js
|
|
94
|
-
? './src/index.js'
|
|
95
|
-
: './src/index.ts'
|
|
96
|
-
: undefined;
|
|
97
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
95
|
+
(0, devkit_1.writeJson)(host, packageJsonPath, {
|
|
98
96
|
name: (0, get_import_path_1.getImportPath)(host, options.name),
|
|
99
97
|
version: '0.0.1',
|
|
100
|
-
|
|
101
|
-
types: sourceEntry,
|
|
98
|
+
...determineEntryFields(options),
|
|
102
99
|
nx: {
|
|
103
100
|
name: options.name,
|
|
104
101
|
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
@@ -119,12 +116,22 @@ async function addProject(host, options) {
|
|
|
119
116
|
project: options.name,
|
|
120
117
|
skipFormat: true,
|
|
121
118
|
});
|
|
119
|
+
(0, devkit_1.updateJson)(host, packageJsonPath, (json) => {
|
|
120
|
+
if (json.type === 'module') {
|
|
121
|
+
// The @nx/rollup:configuration generator can set the type to 'module' which would
|
|
122
|
+
// potentially break this library.
|
|
123
|
+
delete json.type;
|
|
124
|
+
}
|
|
125
|
+
return json;
|
|
126
|
+
});
|
|
122
127
|
const external = ['react/jsx-runtime', 'react-native', 'react', 'react-dom'];
|
|
123
128
|
project.targets.build = {
|
|
124
129
|
executor: '@nx/rollup:rollup',
|
|
125
130
|
outputs: ['{options.outputPath}'],
|
|
126
131
|
options: {
|
|
127
|
-
outputPath:
|
|
132
|
+
outputPath: options.isUsingTsSolutionConfig
|
|
133
|
+
? `${options.projectRoot}/dist`
|
|
134
|
+
: `dist/${options.projectRoot}`,
|
|
128
135
|
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
|
|
129
136
|
project: `${options.projectRoot}/package.json`,
|
|
130
137
|
entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
|
|
@@ -189,4 +196,23 @@ function maybeJs(options, path) {
|
|
|
189
196
|
? path.replace(/\.tsx?$/, '.js')
|
|
190
197
|
: path;
|
|
191
198
|
}
|
|
199
|
+
function determineEntryFields(options) {
|
|
200
|
+
if (options.buildable) {
|
|
201
|
+
return {};
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
main: options.js ? './src/index.js' : './src/index.ts',
|
|
205
|
+
types: options.js ? './src/index.js' : './src/index.ts',
|
|
206
|
+
exports: {
|
|
207
|
+
'.': options.js
|
|
208
|
+
? './src/index.js'
|
|
209
|
+
: {
|
|
210
|
+
types: './src/index.ts',
|
|
211
|
+
import: './src/index.ts',
|
|
212
|
+
default: './src/index.ts',
|
|
213
|
+
},
|
|
214
|
+
'./package.json': './package.json',
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
192
218
|
exports.default = reactNativeLibraryGenerator;
|