Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): allow multiple targets in show projects commmand #18506

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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