Skip to content

Commit

Permalink
fix(core): ignore angular.json projects if @nrwl/angular is not insta…
Browse files Browse the repository at this point in the history
…lled
  • Loading branch information
FrozenPandaz committed Dec 14, 2022
1 parent 486516e commit bda2a75
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/nx/src/config/workspaces.ts
Expand Up @@ -33,7 +33,8 @@ import { joinPathFragments } from '../utils/path';
export function workspaceConfigName(
root: string
): 'angular.json' | 'workspace.json' | null {
if (existsSync(path.join(root, 'angular.json'))) {
// If a workspace doesn't have `@nrwl/angular` it's likely they do not want projects from `angular.json` to be considered by Nx.
if (existsSync(path.join(root, 'angular.json')) && isNrwlAngularInstalled()) {
return 'angular.json';
} else if (existsSync(path.join(root, 'workspace.json'))) {
return 'workspace.json';
Expand Down Expand Up @@ -431,6 +432,15 @@ function assertValidWorkspaceConfiguration(
}
}

function isNrwlAngularInstalled() {
try {
require.resolve('@nrwl/angular');
return true;
} catch {
return false;
}
}

function findFullGeneratorName(
name: string,
generators: {
Expand Down
1 change: 1 addition & 0 deletions scripts/depcheck/missing.ts
Expand Up @@ -124,6 +124,7 @@ const IGNORE_MATCHES_IN_PACKAGE = {
'@angular-devkit/core',
'@angular-devkit/architect',
'@angular/cli',
'@nrwl/angular',
'ts-node', // We *may* fall back on ts-node, but we want to encourage the use of @swc-node instead so we don't explicitly list ts-node as an optional dep
],
web: [
Expand Down

0 comments on commit bda2a75

Please sign in to comment.