Skip to content

feat: suggest installing dependency as devDependency when appropriate#1052

Open
wojtekmaj wants to merge 3 commits intonpmx-dev:mainfrom
wojtekmaj:dev-dependency-suggestion
Open

feat: suggest installing dependency as devDependency when appropriate#1052
wojtekmaj wants to merge 3 commits intonpmx-dev:mainfrom
wojtekmaj:dev-dependency-suggestion

Conversation

@wojtekmaj
Copy link
Contributor

Closes #530

Examples:

image image

Copilot AI review requested due to automatic review settings February 5, 2026 22:19
@vercel
Copy link

vercel bot commented Feb 5, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 5, 2026 10:39pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 5, 2026 10:39pm
npmx-lunaria Ignored Ignored Feb 5, 2026 10:39pm

Request Review

@wojtekmaj wojtekmaj force-pushed the dev-dependency-suggestion branch from 2e5f52c to 52c29be Compare February 5, 2026 22:19
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
lunaria/files/en-GB.json Localization changed, will be marked as complete.
lunaria/files/en-US.json Source changed, localizations will be marked as outdated.
lunaria/files/pl-PL.json Localization changed, will be marked as complete.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Adds dev-dependency suggestion and dev-install command support. Introduces a readmeHtml prop to TerminalExecute/TerminalInstall components. Extends app/utils/install-command.ts with dev?: boolean in InstallCommandOptions, new types/interfaces and functions (getDevDependencySuggestion, getDevDependencyFlag), README-hint and known-package detection, and injects the package-manager dev flag into generated install commands. Updates Install.vue to render a “Suggested dev dependency install command” section with per-package-manager commands and copy-to-clipboard handling. Adds i18n keys and unit tests covering dev-dependency detection and command generation.

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description references issue #530 and includes visual examples demonstrating the feature to suggest devDependency installation with example commands.
Linked Issues check ✅ Passed The PR implements core objectives from #530: detects packages via known-package heuristic and README scanning, adds devDependency flag to install commands, and provides UI for users to copy dev install variants.
Out of Scope Changes check ✅ Passed All changes directly support the devDependency suggestion feature: utility logic, component props, template rendering, and i18n strings. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements automatic detection and suggestion of dev dependency installation commands for packages that are typically installed as development dependencies. The feature addresses issue #530 by helping developers avoid mistakenly adding dev-only tools as regular dependencies.

Changes:

  • Added dev dependency detection heuristics based on a curated list of known dev packages and README analysis
  • Updated install command generation to support a dev flag that adds the appropriate flag (-D or -d for bun) to the install command
  • Modified the Terminal/Install UI component to display a suggested dev install command when appropriate
  • Added internationalization support for the new UI text in English and Polish locales

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
app/utils/install-command.ts Core logic for dev dependency detection, including known package list, README parsing, and command generation with dev flags
app/components/Terminal/Install.vue UI implementation showing suggested dev install command when recommended, with copy functionality
app/pages/package/[...package].vue Integration to pass README HTML data to Terminal/Install component
test/unit/app/utils/install-command.spec.ts Comprehensive tests for dev install commands, detection heuristics, and flag generation
i18n/locales/en.json, pl-PL.json, en-GB.json, en-US.json Translation strings for new UI text
lunaria/files/*.json Translation tracking files for localization workflow

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
app/components/Terminal/Install.vue (1)

161-194: Remove the per-button focus‑visible outline utility.

The new dev install copy button adds an inline focus-visible:outline-accent/70 class, but button focus outlines are handled globally. Please drop the outline utility and rely on the global rule.

Suggested change
-              class="px-2 py-0.5 font-mono text-xs text-fg-muted bg-bg-subtle/80 border border-border rounded transition-colors duration-200 opacity-0 group-hover/devinstallcmd:opacity-100 hover:(text-fg border-border-hover) active:scale-95 focus-visible:opacity-100 focus-visible:outline-accent/70 select-none"
+              class="px-2 py-0.5 font-mono text-xs text-fg-muted bg-bg-subtle/80 border border-border rounded transition-colors duration-200 opacity-0 group-hover/devinstallcmd:opacity-100 hover:(text-fg border-border-hover) active:scale-95 focus-visible:opacity-100 select-none"

Based on learnings: focus-visible styling for button and select elements is implemented globally in app/assets/main.css; avoid per-element focus-visible utility classes like focus-visible:outline-accent/70.

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 82.14286% with 10 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 74.28% 9 Missing ⚠️
app/components/Terminal/Install.vue 95.23% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggest installing dependency as devDependency when deemed appropriate

1 participant