Skip to content

Commit

Permalink
fix(angular): read angularjson from the dir provided by the angular cli
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed May 15, 2023
1 parent 5419811 commit 428b0c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
18 changes: 11 additions & 7 deletions packages/nx/src/adapter/angular-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,19 @@ export function isAngularPluginInstalled() {
}
}

function readAngularJson() {
return toNewFormat(readJsonFile(path.join(workspaceRoot, 'angular.json')))
.projects;
function readAngularJson(angularCliWorkspaceRoot: string) {
return toNewFormat(
readJsonFile(path.join(angularCliWorkspaceRoot, 'angular.json'))
).projects;
}

export function mergeAngularJsonAndGlobProjects(globProjects: {
[name: string]: ProjectConfiguration;
}): { [name: string]: ProjectConfiguration } {
const res = readAngularJson();
export function mergeAngularJsonAndGlobProjects(
globProjects: {
[name: string]: ProjectConfiguration;
},
angularCliWorkspaceRoot: string
): { [name: string]: ProjectConfiguration } {
const res = readAngularJson(angularCliWorkspaceRoot);
const folders = new Set();
for (let k of Object.keys(res)) {
folders.add(res[k].root);
Expand Down
3 changes: 2 additions & 1 deletion packages/nx/src/config/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export class Workspaces {
)
) {
projectsConfigurations.projects = mergeAngularJsonAndGlobProjects(
projectsConfigurations.projects
projectsConfigurations.projects,
this.root
);
}
this.cachedProjectsConfig = this.mergeTargetDefaultsIntoProjectDescriptions(
Expand Down
8 changes: 1 addition & 7 deletions packages/nx/src/executors/utils/convert-nx-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ export function convertNxExecutor(executor: Executor) {
const projectsConfigurations = workspaces.readProjectsConfigurations();

const promise = async () => {
let projectGraph: ProjectGraph;
try {
projectGraph = readCachedProjectGraph();
} catch {
projectGraph = await createProjectGraphAsync();
}
const nxJsonConfiguration = workspaces.readNxJson();
const context: ExecutorContext = {
root: builderContext.workspaceRoot,
Expand All @@ -39,7 +33,7 @@ export function convertNxExecutor(executor: Executor) {
nxJsonConfiguration,
workspace: { ...projectsConfigurations, ...nxJsonConfiguration },
cwd: process.cwd(),
projectGraph,
projectGraph: null,
isVerbose: false,
};
return executor(options, context);
Expand Down

1 comment on commit 428b0c9

@vercel
Copy link

@vercel vercel bot commented on 428b0c9 May 15, 2023

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-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.