Skip to content

fix(ui): render only the selected terminal command#3023

Open
juninhokaponne wants to merge 3 commits into
npmx-dev:mainfrom
juninhokaponne:fix/3016-terminal-pm-rendering
Open

fix(ui): render only the selected terminal command#3023
juninhokaponne wants to merge 3 commits into
npmx-dev:mainfrom
juninhokaponne:fix/3016-terminal-pm-rendering

Conversation

@juninhokaponne

@juninhokaponne juninhokaponne commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Fixes #3016

🧭 Context

The terminal rendered all package manager commands and hid the inactive ones with CSS. Since they were still in the DOM, the layout wasn't consistent when the last package manager was selected.

📚 Description

This PR changes the terminal to render only the selected package manager command.

I also moved the package manager selection logic into a shared helper to avoid repeating the same code.

A regression test was added to make sure only the selected command is rendered.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jul 23, 2026 12:14pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jul 23, 2026 12:14pm
npmx-lunaria Ignored Ignored Jul 23, 2026 12:14pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 02b25cf7-9002-4417-a745-20a8470d28dc

📥 Commits

Reviewing files that changed from the base of the PR and between d04c0de and 018d3b5.

📒 Files selected for processing (1)
  • app/components/Terminal/Install.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/Terminal/Install.vue

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Terminal command displays now show only the currently selected package manager’s commands.
    • Install-related command suggestions (including development, types, run, and create) are now consistent with the selected package manager.
    • Copyable installation commands now derive the selected package manager correctly, with a safe fallback when needed.
  • Tests
    • Added Vitest coverage to confirm Terminal views render only the selected package manager’s command variants and content.

Walkthrough

Terminal Execute and Install now render only the currently selected package manager’s command. Shared configuration lookup is used by terminal components and install-command construction, replacing CSS-based variant visibility. Tests verify selected-manager output.

Changes

Selected package manager rendering

Layer / File(s) Summary
Package manager config lookup and command construction
app/utils/install-command.ts, app/composables/useInstallCommand.ts
Adds getPackageManagerConfig with npm fallback and uses it to construct @types command parts and the full install command.
Execute.vue single-variant rendering
app/components/Terminal/Execute.vue
Resolves the selected package manager, renders one execute command, and removes CSS-based visibility handling.
Install.vue single-variant rendering
app/components/Terminal/Install.vue
Renders selected-manager variants for install, development, types, run, and create commands.
Terminal component tests
test/nuxt/components/Terminal.spec.ts
Verifies that TerminalExecute and TerminalInstall render only commands for the selected package manager, including expected counts and command text.

Possibly related PRs

  • npmx-dev/npmx.dev#3014: Both changes touch terminal command rendering and package manager configuration used for nub commands.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: rendering only the selected terminal command.
Description check ✅ Passed The description is directly related to the rendered-command fix and added regression test.
Linked Issues check ✅ Passed The changes address #3016 by rendering only the active package manager in Install and Execute.
Out of Scope Changes check ✅ Passed The helper refactor and test coverage support the stated fix and do not appear unrelated.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @juninhokaponne! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/utils/install-command.ts 42.85% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@juninhokaponne

Copy link
Copy Markdown
Contributor Author

@graphieros could you review my changes?

@graphieros
graphieros requested a review from a team July 21, 2026 15:05
@graphieros graphieros added the needs review This PR is waiting for a review from a maintainer label Jul 21, 2026
@graphieros

Copy link
Copy Markdown
Member

@juninhokaponne

The fix seems to work.
I just have a question: did you write the PR description by yourself, or with AI assistance ?

@graphieros graphieros added the 007 This PR *may* not follow our code of conduct regarding AI usage. label Jul 21, 2026
@juninhokaponne

Copy link
Copy Markdown
Contributor Author

@graphieros Yes, I used AI assistance to help organize and improve the PR description. The entire implementation were done by me. and I made sure the description reflects right the changes before submitting it.

@graphieros

Copy link
Copy Markdown
Member

@graphieros Yes, I used AI assistance to help organize and improve the PR description. The entire implementation were done by me. and I made sure the description reflects right the changes before submitting it.

@juninhokaponne Ok, thank you for honest answer. As you may know, if you read the contribution guide, we do not mind if contributors use AI to assist with coding, as long as the result is thoroughly reviewed by the author before submitting the PR. However, we insist that PR descriptions be in your own words. Our vision of open-source is also about human connection.

@juninhokaponne

Copy link
Copy Markdown
Contributor Author

Oh, I got it, and I completely agree with that. I'll update the PR description and rewrite it in my own words.

Thanks for taking the time to explain it. I'm really enjoying contributing to the npmx project, and I'd love to become a more active contributor over time. I really appreciate the guidance!

@graphieros Yes, I used AI assistance to help organize and improve the PR description. The entire implementation were done by me. and I made sure the description reflects right the changes before submitting it.

@juninhokaponne Ok, thank you for honest answer. As you may know, if you read the contribution guide, we do not mind if contributors use AI to assist with coding, as long as the result is thoroughly reviewed by the author before submitting the PR. However, we insist that PR descriptions be in your own words. Our vision of open-source is also about human connection.

@juninhokaponne

Copy link
Copy Markdown
Contributor Author

@graphieros I've updated the PR description.

Comment thread app/components/Terminal/Execute.vue Outdated
Comment thread app/composables/useInstallCommand.ts Outdated
Comment thread app/components/Terminal/Install.vue Outdated

@graphieros graphieros left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 🌿

@graphieros
graphieros requested a review from a team July 23, 2026 12:42
@graphieros graphieros removed the 007 This PR *may* not follow our code of conduct regarding AI usage. label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review This PR is waiting for a review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package manager command box height inconsistent when last PM in list is selected

2 participants