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

Commit 40c5eeb

Browse files
committed
feat(@angular-devkit/core): add workspace.listProjectNames()
1 parent 1523765 commit 40c5eeb

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export class Workspace {
136136
return this._workspace.newProjectRoot;
137137
}
138138

139+
listProjectNames(): string[] {
140+
return Object.keys(this._workspace.projects);
141+
}
142+
139143
getProject(projectName: string): WorkspaceProject {
140144
this._assertLoaded();
141145

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ describe('Workspace', () => {
157157
).subscribe(undefined, done.fail, done);
158158
});
159159

160+
it('lists project names', (done) => {
161+
const workspace = new Workspace(root, host);
162+
workspace.loadWorkspaceFromJson(workspaceJson).pipe(
163+
tap((ws) => expect(ws.listProjectNames()).toEqual(['app'])),
164+
).subscribe(undefined, done.fail, done);
165+
});
166+
160167
it('gets project by name', (done) => {
161168
const workspace = new Workspace(root, host);
162169
workspace.loadWorkspaceFromJson(workspaceJson).pipe(

0 commit comments

Comments
 (0)