@nx/expo 19.2.0-rc.0 → 19.2.0-rc.1

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/expo",
3
- "version": "19.2.0-rc.0",
3
+ "version": "19.2.0-rc.1",
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": [
@@ -28,7 +28,7 @@
28
28
  "main": "./index",
29
29
  "types": "index.d.ts",
30
30
  "dependencies": {
31
- "@nx/devkit": "19.2.0-rc.0",
31
+ "@nx/devkit": "19.2.0-rc.1",
32
32
  "chalk": "^4.1.0",
33
33
  "enhanced-resolve": "^5.8.3",
34
34
  "fs-extra": "^11.1.0",
@@ -37,13 +37,13 @@
37
37
  "node-fetch": "^2.6.7",
38
38
  "tslib": "^2.3.0",
39
39
  "tsconfig-paths": "^4.1.2",
40
- "@nx/jest": "19.2.0-rc.0",
41
- "@nx/js": "19.2.0-rc.0",
42
- "@nx/eslint": "19.2.0-rc.0",
43
- "@nx/react": "19.2.0-rc.0",
44
- "@nx/web": "19.2.0-rc.0",
45
- "@nx/webpack": "19.2.0-rc.0",
46
- "@nrwl/expo": "19.2.0-rc.0"
40
+ "@nx/jest": "19.2.0-rc.1",
41
+ "@nx/js": "19.2.0-rc.1",
42
+ "@nx/eslint": "19.2.0-rc.1",
43
+ "@nx/react": "19.2.0-rc.1",
44
+ "@nx/web": "19.2.0-rc.1",
45
+ "@nx/webpack": "19.2.0-rc.1",
46
+ "@nrwl/expo": "19.2.0-rc.1"
47
47
  },
48
48
  "executors": "./executors.json",
49
49
  "ng-update": {
@@ -2,4 +2,5 @@ export interface ExpoSyncDepsOptions {
2
2
  include: string[] | string; // default is an empty array []
3
3
  exclude: string[] | string; // default is an empty array []
4
4
  all: boolean; // default is false
5
+ excludeImplicit: boolean; // default is false
5
6
  }
@@ -28,6 +28,11 @@
28
28
  "type": "boolean",
29
29
  "description": "Copy all dependencies and devDependencies from the workspace root package.json.",
30
30
  "default": false
31
+ },
32
+ "excludeImplicit": {
33
+ "type": "boolean",
34
+ "description": "This will ignore npm packages from projects listed in implicitDependencies (e.g. backend API projects)",
35
+ "default": false
31
36
  }
32
37
  }
33
38
  }
@@ -5,5 +5,5 @@ export interface ReactNativeSyncDepsOutput {
5
5
  success: boolean;
6
6
  }
7
7
  export default function syncDepsExecutor(options: ExpoSyncDepsOptions, context: ExecutorContext): AsyncGenerator<ReactNativeSyncDepsOutput>;
8
- export declare function syncDeps(projectName: string, projectPackageJson: PackageJson, projectPackageJsonPath: string, workspacePackageJson: PackageJson, projectGraph?: ProjectGraph, include?: string[], exclude?: string[], all?: boolean): Promise<string[]>;
8
+ export declare function syncDeps(projectName: string, projectPackageJson: PackageJson, projectPackageJsonPath: string, workspacePackageJson: PackageJson, projectGraph?: ProjectGraph, include?: string[], exclude?: string[], all?: boolean, excludeImplicit?: boolean): Promise<string[]>;
9
9
  export declare function displayNewlyAddedDepsMessage(projectName: string, deps: string[]): void;
@@ -15,14 +15,14 @@ async function* syncDepsExecutor(options, context) {
15
15
  ? options.include.split(',')
16
16
  : options.include, typeof options.exclude === 'string'
17
17
  ? options.exclude.split(',')
18
- : options.exclude, options.all));
18
+ : options.exclude, options.all, options.excludeImplicit));
19
19
  yield { success: true };
20
20
  }
21
21
  exports.default = syncDepsExecutor;
22
- async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, projectGraph = (0, devkit_1.readCachedProjectGraph)(), include = [], exclude = [], all = false) {
22
+ async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, projectGraph = (0, devkit_1.readCachedProjectGraph)(), include = [], exclude = [], all = false, excludeImplicit = false) {
23
23
  let npmDeps = all
24
24
  ? Object.keys(workspacePackageJson.dependencies || {})
25
- : (0, find_all_npm_dependencies_1.findAllNpmDependencies)(projectGraph, projectName);
25
+ : (0, find_all_npm_dependencies_1.findAllNpmDependencies)(projectGraph, projectName, { excludeImplicit });
26
26
  let npmDevdeps = all
27
27
  ? Object.keys(workspacePackageJson.devDependencies || {})
28
28
  : [];
@@ -1,2 +1,6 @@
1
- import { ProjectGraph } from '@nx/devkit';
2
- export declare function findAllNpmDependencies(graph: ProjectGraph, projectName: string, list?: string[], seen?: Set<string>): string[];
1
+ import { type ProjectGraph } from '@nx/devkit';
2
+ type Options = {
3
+ excludeImplicit: boolean;
4
+ };
5
+ export declare function findAllNpmDependencies(graph: ProjectGraph, projectName: string, options?: Options, seen?: Set<string>): string[];
6
+ export {};
@@ -1,27 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
- }
4
+ // Don't want to include '@nx/react-native' and '@nx/expo' because React Native
5
+ // autolink will warn that the package has no podspec file for iOS.
6
+ const EXCLUDED_EXTERNAL_NODES = new Set([
7
+ 'npm:@nx/react-native',
8
+ 'npm:@nrwl/react-native',
9
+ 'npm:@nx/expo',
10
+ 'npm:@nrwl/expo',
11
+ ]);
12
+ function findAllNpmDependencies(graph, projectName, options = { excludeImplicit: false }, seen = new Set()) {
13
+ // Guard Case: In case of bad circular dependencies
14
+ if (seen.has(projectName))
15
+ return [];
9
16
  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));
17
+ // Base/Termination Case: when it finds a valid package in externalNodes
18
+ const node = graph.externalNodes?.[projectName];
19
+ if (node && !EXCLUDED_EXTERNAL_NODES.has(node.name)) {
20
+ return [node.data.packageName];
24
21
  }
25
- return list;
22
+ // Recursive Case: Digging into related projects' dependencies
23
+ return ((graph.dependencies[projectName] || [])
24
+ // Conditional filtering based on options
25
+ .filter(getFilterPredicate(options))
26
+ // this is where the recursion happens
27
+ .flatMap((dep) => findAllNpmDependencies(graph, dep.target, options, seen)));
26
28
  }
27
29
  exports.findAllNpmDependencies = findAllNpmDependencies;
30
+ // This function is used to filter out dependencies based on the options
31
+ // provided.
32
+ function getFilterPredicate(options) {
33
+ return (dep) => [
34
+ // base predicate returns true so it filters out nothing
35
+ (_pDep) => true,
36
+ // conditionally filter implicit dependencies based on the option
37
+ ...(options?.excludeImplicit
38
+ ? [(pDep) => pDep.type !== 'implicit']
39
+ : []),
40
+ // Future conditions can be added here in a similar way
41
+ ].every((predicate) => predicate(dep));
42
+ }