@nx/expo 18.0.4 → 18.0.5
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 +9 -9
- package/src/executors/sync-deps/schema.d.ts +1 -0
- package/src/executors/sync-deps/schema.json +5 -0
- package/src/executors/sync-deps/sync-deps.impl.d.ts +3 -2
- package/src/executors/sync-deps/sync-deps.impl.js +27 -20
- package/src/executors/update/update.impl.js +5 -1
- package/src/generators/application/files/src/app/App.tsx.template +1 -1
- package/src/utils/find-all-npm-dependencies.d.ts +2 -0
- package/src/utils/find-all-npm-dependencies.js +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"main": "./index.js",
|
|
27
27
|
"types": "index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@nx/devkit": "18.0.
|
|
29
|
+
"@nx/devkit": "18.0.5",
|
|
30
30
|
"chalk": "^4.1.0",
|
|
31
31
|
"enhanced-resolve": "^5.8.3",
|
|
32
32
|
"fs-extra": "^11.1.0",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"tslib": "^2.3.0",
|
|
37
37
|
"tsconfig-paths": "^4.1.2",
|
|
38
38
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
39
|
-
"@nx/jest": "18.0.
|
|
40
|
-
"@nx/js": "18.0.
|
|
41
|
-
"@nx/eslint": "18.0.
|
|
42
|
-
"@nx/react": "18.0.
|
|
43
|
-
"@nx/web": "18.0.
|
|
44
|
-
"@nx/webpack": "18.0.
|
|
45
|
-
"@nrwl/expo": "18.0.
|
|
39
|
+
"@nx/jest": "18.0.5",
|
|
40
|
+
"@nx/js": "18.0.5",
|
|
41
|
+
"@nx/eslint": "18.0.5",
|
|
42
|
+
"@nx/react": "18.0.5",
|
|
43
|
+
"@nx/web": "18.0.5",
|
|
44
|
+
"@nx/webpack": "18.0.5",
|
|
45
|
+
"@nrwl/expo": "18.0.5"
|
|
46
46
|
},
|
|
47
47
|
"executors": "./executors.json",
|
|
48
48
|
"ng-update": {
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"default": [],
|
|
25
25
|
"description": "An array of npm packages to exclude."
|
|
26
|
+
},
|
|
27
|
+
"all": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"description": "Copy all dependencies and devDependencies from the workspace root package.json.",
|
|
30
|
+
"default": false
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
1
|
+
import { ExecutorContext, ProjectGraph } from '@nx/devkit';
|
|
2
2
|
import { ExpoSyncDepsOptions } from './schema';
|
|
3
|
+
import { PackageJson } from 'nx/src/utils/package-json';
|
|
3
4
|
export interface ReactNativeSyncDepsOutput {
|
|
4
5
|
success: boolean;
|
|
5
6
|
}
|
|
6
7
|
export default function syncDepsExecutor(options: ExpoSyncDepsOptions, context: ExecutorContext): AsyncGenerator<ReactNativeSyncDepsOutput>;
|
|
7
|
-
export declare function syncDeps(
|
|
8
|
+
export declare function syncDeps(projectName: string, projectPackageJson: PackageJson, projectPackageJsonPath: string, workspacePackageJson: PackageJson, projectGraph?: ProjectGraph, include?: string[], exclude?: string[], all?: boolean): Promise<string[]>;
|
|
8
9
|
export declare function displayNewlyAddedDepsMessage(projectName: string, deps: string[]): void;
|
|
@@ -4,27 +4,32 @@ exports.displayNewlyAddedDepsMessage = exports.syncDeps = void 0;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const find_all_npm_dependencies_1 = require("../../utils/find-all-npm-dependencies");
|
|
7
8
|
async function* syncDepsExecutor(options, context) {
|
|
8
9
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
9
|
-
|
|
10
|
+
const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
|
|
11
|
+
const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
|
|
12
|
+
const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
|
|
13
|
+
const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
|
|
14
|
+
displayNewlyAddedDepsMessage(context.projectName, await syncDeps(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, typeof options.include === 'string'
|
|
10
15
|
? options.include.split(',')
|
|
11
16
|
: options.include, typeof options.exclude === 'string'
|
|
12
17
|
? options.exclude.split(',')
|
|
13
|
-
: options.exclude));
|
|
18
|
+
: options.exclude, options.all));
|
|
14
19
|
yield { success: true };
|
|
15
20
|
}
|
|
16
21
|
exports.default = syncDepsExecutor;
|
|
17
|
-
async function syncDeps(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let npmDevdeps =
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, projectGraph = (0, devkit_1.readCachedProjectGraph)(), include = [], exclude = [], all = false) {
|
|
23
|
+
let npmDeps = all
|
|
24
|
+
? Object.keys(workspacePackageJson.dependencies || {})
|
|
25
|
+
: (0, find_all_npm_dependencies_1.findAllNpmDependencies)(projectGraph, projectName);
|
|
26
|
+
let npmDevdeps = all
|
|
27
|
+
? Object.keys(workspacePackageJson.devDependencies || {})
|
|
28
|
+
: [];
|
|
24
29
|
const newDeps = [];
|
|
25
30
|
let updated = false;
|
|
26
|
-
if (!
|
|
27
|
-
|
|
31
|
+
if (!projectPackageJson.dependencies) {
|
|
32
|
+
projectPackageJson.dependencies = {};
|
|
28
33
|
updated = true;
|
|
29
34
|
}
|
|
30
35
|
if (include && include.length) {
|
|
@@ -33,28 +38,30 @@ async function syncDeps(projectRoot, workspaceRoot, include = [], exclude = [])
|
|
|
33
38
|
if (exclude && exclude.length) {
|
|
34
39
|
npmDeps = npmDeps.filter((dep) => !exclude.includes(dep));
|
|
35
40
|
}
|
|
36
|
-
if (!
|
|
37
|
-
|
|
41
|
+
if (!projectPackageJson.devDependencies) {
|
|
42
|
+
projectPackageJson.devDependencies = {};
|
|
38
43
|
}
|
|
39
|
-
if (!
|
|
40
|
-
|
|
44
|
+
if (!projectPackageJson.dependencies) {
|
|
45
|
+
projectPackageJson.dependencies = {};
|
|
41
46
|
}
|
|
42
47
|
npmDeps.forEach((dep) => {
|
|
43
|
-
if (!
|
|
44
|
-
|
|
48
|
+
if (!projectPackageJson.dependencies[dep] &&
|
|
49
|
+
!projectPackageJson.devDependencies[dep]) {
|
|
50
|
+
projectPackageJson.dependencies[dep] = '*';
|
|
45
51
|
newDeps.push(dep);
|
|
46
52
|
updated = true;
|
|
47
53
|
}
|
|
48
54
|
});
|
|
49
55
|
npmDevdeps.forEach((dep) => {
|
|
50
|
-
if (!
|
|
51
|
-
|
|
56
|
+
if (!projectPackageJson.dependencies[dep] &&
|
|
57
|
+
!projectPackageJson.devDependencies[dep]) {
|
|
58
|
+
projectPackageJson.devDependencies[dep] = '*';
|
|
52
59
|
newDeps.push(dep);
|
|
53
60
|
updated = true;
|
|
54
61
|
}
|
|
55
62
|
});
|
|
56
63
|
if (updated) {
|
|
57
|
-
(0, devkit_1.writeJsonFile)(
|
|
64
|
+
(0, devkit_1.writeJsonFile)(projectPackageJsonPath, projectPackageJson);
|
|
58
65
|
}
|
|
59
66
|
return newDeps;
|
|
60
67
|
}
|
|
@@ -9,8 +9,12 @@ const install_impl_1 = require("../install/install.impl");
|
|
|
9
9
|
let childProcess;
|
|
10
10
|
async function* buildExecutor(options, context) {
|
|
11
11
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
12
|
+
const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
|
|
13
|
+
const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
|
|
14
|
+
const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
|
|
15
|
+
const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
|
|
12
16
|
await (0, install_impl_1.installAsync)(context.root, { packages: ['expo-updates'] });
|
|
13
|
-
(0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(
|
|
17
|
+
(0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, ['expo-updates']));
|
|
14
18
|
try {
|
|
15
19
|
await runCliUpdate(context.root, projectRoot, options);
|
|
16
20
|
yield { success: true };
|
|
@@ -387,7 +387,7 @@ export const App = () => {
|
|
|
387
387
|
</View>
|
|
388
388
|
</View>
|
|
389
389
|
<View style={styles.codeBlock}>
|
|
390
|
-
<Text style={[styles.monospace]}>nx connect
|
|
390
|
+
<Text style={[styles.monospace]}>nx connect</Text>
|
|
391
391
|
</View>
|
|
392
392
|
</View>
|
|
393
393
|
</TouchableOpacity>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findAllNpmDependencies = void 0;
|
|
4
|
+
function findAllNpmDependencies(graph, projectName, list = [], seen = new Set()) {
|
|
5
|
+
// In case of bad circular dependencies
|
|
6
|
+
if (seen.has(projectName)) {
|
|
7
|
+
return list;
|
|
8
|
+
}
|
|
9
|
+
seen.add(projectName);
|
|
10
|
+
const node = graph.externalNodes[projectName];
|
|
11
|
+
// Don't want to include '@nx/react-native' and '@nx/expo' because React Native
|
|
12
|
+
// autolink will warn that the package has no podspec file for iOS.
|
|
13
|
+
if (node) {
|
|
14
|
+
if (node.name !== `npm:@nx/react-native` &&
|
|
15
|
+
node.name !== `npm:@nrwl/react-native` &&
|
|
16
|
+
node.name !== `npm:@nx/expo` &&
|
|
17
|
+
node.name !== `npm:@nrwl/expo`) {
|
|
18
|
+
list.push(node.data.packageName);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// it's workspace project, search for it's dependencies
|
|
23
|
+
graph.dependencies[projectName]?.forEach((dep) => findAllNpmDependencies(graph, dep.target, list, seen));
|
|
24
|
+
}
|
|
25
|
+
return list;
|
|
26
|
+
}
|
|
27
|
+
exports.findAllNpmDependencies = findAllNpmDependencies;
|