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): add an option to seperate the output of show with provide… #23172

Merged
merged 2 commits into from May 7, 2024

Conversation

dasco144
Copy link
Contributor

@dasco144 dasco144 commented May 3, 2024

…d character

npx nx show projects --affected --type=app --sep "," will output the affected projects with a "," separating each project output

closed #22219

Current Behavior

There is no way to change the separator used, the output of npx nx show projects will list all the projects in the workspace separated by a newline character.

Expected Behavior

providing a string for the "sep" arg will output the projects separated by the provided string

e.g. npx nx show projects --sep "," with projects, foo, bar and baz in the workspace, will output foo,bar,baz

Related Issue(s)

Fixes #22219

…d character

`npx nx show projects --affected --type=app --sep ","` will output the affected projects with a ","
seperating each project ouput

closed nrwl#22219
Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview May 6, 2024 4:04pm

@dasco144 dasco144 marked this pull request as ready for review May 3, 2024 18:27
@dasco144 dasco144 requested review from a team as code owners May 3, 2024 18:27
Copy link
Member

@AgentEnder AgentEnder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked mostly good, I went ahead and pushed up the changes I was planning to request.

The biggest thing to keep in mind for future contributions would be that the unit tests you included that used the tree didn't work as intended. They were "passing" because the end of the show projects handler had a process.exit(0) call which shutdown the tests with exit code 0. In actuality, the intended projects didn't exist in the graph found by the show projects handler.

The Tree instance only works with generators, and doesn't affect createProjectGraphAsync. You really have to mock it out, otherwise it ends up creating the graph for whatever the repo that the current project root is in.

In this case, you can see the changed approach in projects.spec.ts

@dasco144
Copy link
Contributor Author

dasco144 commented May 7, 2024

Thanks @AgentEnder, appreciate the feedback 🙏

@AgentEnder AgentEnder merged commit d9a9712 into nrwl:master May 7, 2024
6 checks passed
@dasco144 dasco144 deleted the add-seperator-option-for-nx-show branch May 7, 2024 17:56
FrozenPandaz pushed a commit that referenced this pull request May 7, 2024
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does the command "nx show projects" return a list separated by new line by default?
2 participants