@nx/react-native 23.0.0-beta.17 → 23.0.0-beta.19
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 +8 -8
- package/plugins/plugin.d.ts.map +1 -1
- package/plugins/plugin.js +53 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.19",
|
|
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": [
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"type": "commonjs",
|
|
28
28
|
"types": "index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nx/devkit": "23.0.0-beta.
|
|
31
|
-
"@nx/js": "23.0.0-beta.
|
|
32
|
-
"@nx/eslint": "23.0.0-beta.
|
|
33
|
-
"@nx/react": "23.0.0-beta.
|
|
30
|
+
"@nx/devkit": "23.0.0-beta.19",
|
|
31
|
+
"@nx/js": "23.0.0-beta.19",
|
|
32
|
+
"@nx/eslint": "23.0.0-beta.19",
|
|
33
|
+
"@nx/react": "23.0.0-beta.19",
|
|
34
34
|
"ajv": "^8.0.0",
|
|
35
35
|
"enhanced-resolve": "^5.8.3",
|
|
36
36
|
"ignore": "^7.0.5",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"metro-resolver": ">= 0.82.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"nx": "23.0.0-beta.
|
|
47
|
+
"nx": "23.0.0-beta.19"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@nx/detox": "23.0.0-beta.
|
|
51
|
-
"@nx/rollup": "23.0.0-beta.
|
|
50
|
+
"@nx/detox": "23.0.0-beta.19",
|
|
51
|
+
"@nx/rollup": "23.0.0-beta.19"
|
|
52
52
|
},
|
|
53
53
|
"executors": "./executors.json",
|
|
54
54
|
"ng-update": {
|
package/plugins/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../packages/react-native/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../packages/react-native/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAML,aAAa,EAMd,MAAM,YAAY,CAAC;AAOpB,MAAM,WAAW,wBAAwB;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAOD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,wBAAwB,CA6D/D,CAAC;AAEF,eAAO,MAAM,aAAa,yCAAc,CAAC"}
|
package/plugins/plugin.js
CHANGED
|
@@ -15,8 +15,29 @@ exports.createNodes = [
|
|
|
15
15
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `react-native-${optionsHash}.hash`);
|
|
16
16
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
17
17
|
const lockFileName = (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
18
|
+
const normalizedOptions = normalizeOptions(options);
|
|
18
19
|
try {
|
|
19
|
-
|
|
20
|
+
const { entries, preErrors } = await filterReactNativeConfigs(configFiles, context);
|
|
21
|
+
const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
|
|
22
|
+
let results = [];
|
|
23
|
+
let nodeErrors = [];
|
|
24
|
+
try {
|
|
25
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, projectHashes[idx]), entries.map((e) => e.configFile), options, context);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
29
|
+
results = e.partialResults ?? [];
|
|
30
|
+
nodeErrors = e.errors;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const allErrors = [...preErrors, ...nodeErrors];
|
|
37
|
+
if (allErrors.length > 0) {
|
|
38
|
+
throw new devkit_1.AggregateCreateNodesError(allErrors, results);
|
|
39
|
+
}
|
|
40
|
+
return results;
|
|
20
41
|
}
|
|
21
42
|
finally {
|
|
22
43
|
targetsCache.writeToDisk();
|
|
@@ -24,24 +45,8 @@ exports.createNodes = [
|
|
|
24
45
|
},
|
|
25
46
|
];
|
|
26
47
|
exports.createNodesV2 = exports.createNodes;
|
|
27
|
-
async function createNodesInternal(configFile, options, context, targetsCache,
|
|
28
|
-
options = normalizeOptions(options);
|
|
48
|
+
async function createNodesInternal(configFile, options, context, targetsCache, hash) {
|
|
29
49
|
const projectRoot = (0, path_1.dirname)(configFile);
|
|
30
|
-
// Do not create a project if package.json or project.json or metro.config.js isn't there.
|
|
31
|
-
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
32
|
-
if (!siblingFiles.includes('package.json') ||
|
|
33
|
-
!siblingFiles.includes('metro.config.js')) {
|
|
34
|
-
return {};
|
|
35
|
-
}
|
|
36
|
-
// Check if it's an Expo project
|
|
37
|
-
const packageJson = (0, devkit_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, projectRoot, 'package.json'));
|
|
38
|
-
const appConfig = await getAppConfig(configFile, context);
|
|
39
|
-
if (appConfig.expo ||
|
|
40
|
-
packageJson.dependencies?.['expo'] ||
|
|
41
|
-
packageJson.devDependencies?.['expo']) {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
const hash = await (0, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [lockFileName]);
|
|
45
50
|
if (!targetsCache.has(hash)) {
|
|
46
51
|
targetsCache.set(hash, buildReactNativeTargets(projectRoot, options, context));
|
|
47
52
|
}
|
|
@@ -112,6 +117,36 @@ function getAppConfig(configFilePath, context) {
|
|
|
112
117
|
const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
|
|
113
118
|
return (0, internal_1.loadConfigFile)(resolvedPath);
|
|
114
119
|
}
|
|
120
|
+
async function filterReactNativeConfigs(configFiles, context) {
|
|
121
|
+
const preErrors = [];
|
|
122
|
+
const candidates = await Promise.all(configFiles.map(async (configFile) => {
|
|
123
|
+
try {
|
|
124
|
+
const projectRoot = (0, path_1.dirname)(configFile);
|
|
125
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
126
|
+
if (!siblingFiles.includes('package.json') ||
|
|
127
|
+
!siblingFiles.includes('metro.config.js')) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
// Skip Expo projects; the @nx/expo plugin handles them.
|
|
131
|
+
const packageJson = (0, devkit_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, projectRoot, 'package.json'));
|
|
132
|
+
const appConfig = await getAppConfig(configFile, context);
|
|
133
|
+
if (appConfig.expo ||
|
|
134
|
+
packageJson.dependencies?.['expo'] ||
|
|
135
|
+
packageJson.devDependencies?.['expo']) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return { configFile, projectRoot };
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
preErrors.push([configFile, e]);
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
145
|
+
return {
|
|
146
|
+
entries: candidates.filter((c) => c !== null),
|
|
147
|
+
preErrors,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
115
150
|
function getInputs(namedInputs) {
|
|
116
151
|
return [
|
|
117
152
|
...('production' in namedInputs
|