Skip to content

Commit

Permalink
fix(angular): expand extends property when reading nx.json in the ang…
Browse files Browse the repository at this point in the history
…ular cli adapter (#10165)
  • Loading branch information
leosvelperez committed May 5, 2022
1 parent a2b704d commit 0a1e822
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/nx/src/adapter/ngcli-adapter.ts
Expand Up @@ -38,6 +38,7 @@ import {
RawWorkspaceJsonConfiguration,
WorkspaceJsonConfiguration,
} from '../config/workspace-json-project-json';
import { readNxJson } from '../generators/utils/project-configuration';

export async function scheduleTarget(
root: string,
Expand Down Expand Up @@ -261,10 +262,17 @@ export class NxScopedHost extends virtualFs.ScopedHost<any> {
};

const readNxJsonFile = () => {
if (overrides?.nx) {
return overrides.nx;
}
return readJsonFile('nx.json');
let nxJson = overrides?.nx ? overrides.nx : readJsonFile('nx.json');

return nxJson.pipe(
map((json) => {
if (json.extends) {
return { ...require(json.extends), ...json };
} else {
return json;
}
})
);
};

return super.exists('nx.json' as Path).pipe(
Expand Down Expand Up @@ -599,9 +607,7 @@ export class NxScopeHostUsedForWrappedSchematics extends NxScopedHost {
// we have to add them into the file.
const createdProjectFiles = findCreatedProjects(this.host);
const deletedProjectFiles = findDeletedProjects(this.host);
const nxJsonInTree = nxJsonChange
? parseJson(nxJsonChange.content.toString())
: parseJson(this.host.read('nx.json').toString());
const nxJsonInTree = readNxJson(this.host);
const readJsonWithHost = (file) => ({
root: dirname(file),
...parseJson(this.host.read(file).toString()),
Expand Down

1 comment on commit 0a1e822

@vercel
Copy link

@vercel vercel bot commented on 0a1e822 May 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx.dev
nx-five.vercel.app
nx-dev-nrwl.vercel.app

Please sign in to comment.