Skip to content

Commit

Permalink
fix(core): last project should be visible in nx show projects
Browse files Browse the repository at this point in the history
Observed last project not being visible when running `nx show`
  • Loading branch information
AgentEnder committed Mar 1, 2023
1 parent d21eb1d commit 5dc3523
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e2e/nx-misc/src/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Nx Commands', () => {

const s = runCLI('show projects').split('\n');

expect(s.length).toEqual(4);
expect(s.length).toEqual(5);
expect(s).toContain(app1);
expect(s).toContain(app2);
expect(s).toContain(`${app1}-e2e`);
Expand Down
5 changes: 4 additions & 1 deletion packages/nx/src/command-line/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { createProjectGraphAsync } from '../project-graph/project-graph';
export async function show(args: { object: 'projects' }): Promise<void> {
if (args.object == 'projects') {
const graph = await createProjectGraphAsync();
process.stdout.write(Object.keys(graph.nodes).join('\n'));
const projects = Object.keys(graph.nodes).join('\n');
if (projects.length) {
console.log(projects);
}
} else {
throw new Error(`Unrecognized option: ${args.object}`);
}
Expand Down

0 comments on commit 5dc3523

Please sign in to comment.