Skip to content

Commit

Permalink
feat(core): allow multiple targets in show projects commmand (#18506)
Browse files Browse the repository at this point in the history
  • Loading branch information
yharaskrik authored Sep 21, 2023
1 parent 57dc105 commit 5545ffb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/nx/src/command-line/show/command-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type ShowProjectsOptions = NxShowArgs & {
head: string;
affected: boolean;
projects: string[];
withTarget: string;
withTarget: string[];
};

export type ShowProjectOptions = NxShowArgs & {
Expand Down Expand Up @@ -73,6 +73,7 @@ const showProjectsCommand: CommandModule<NxShowArgs, ShowProjectsOptions> = {
type: 'string',
alias: ['t'],
description: 'Show only projects that have a specific target',
coerce: parseCSV,
})
.implies('untracked', 'affected')
.implies('uncommitted', 'affected')
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/show/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function showProjectsHandler(

if (args.withTarget) {
graph.nodes = Object.entries(graph.nodes).reduce((acc, [name, node]) => {
if (node.data.targets?.[args.withTarget]) {
if (args.withTarget.some((target) => node.data.targets?.[target])) {
acc[name] = node;
}
return acc;
Expand Down

0 comments on commit 5545ffb

Please sign in to comment.