Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(angular): expand extends property when reading nx.json in the angular cli adapter #10165

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 13 additions & 7 deletions packages/nx/src/adapter/ngcli-adapter.ts
Original file line number Diff line number Diff line change
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);
AgentEnder marked this conversation as resolved.
Show resolved Hide resolved
const readJsonWithHost = (file) => ({
root: dirname(file),
...parseJson(this.host.read(file).toString()),
Expand Down