Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 67a3d0e

Browse files
committed
feat(@angular-devkit/core): use the root project as default project by default
If there isn't any defaultProject set, permit to use the "root project" (ie the one which isn't in the `/projects/` folder) as the default project "by default" if it exists.
1 parent 4307ea0 commit 67a3d0e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/angular_devkit/core/src/workspace/workspace.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ export class Workspace {
140140
} else if (this.listProjectNames().length === 1) {
141141
// If there is only one project, return that one.
142142
return this.listProjectNames()[0];
143+
} else {
144+
const rootProjectEntry = Object.entries(this._workspace.projects).find(([name, project]) => {
145+
return project.root.length === 0;
146+
});
147+
if (rootProjectEntry) {
148+
return rootProjectEntry[0];
149+
}
143150
}
144151

145152
// Otherwise return null.

0 commit comments

Comments
 (0)