Skip to content

Conversation

@eryue0220
Copy link

resolve #40

@vercel
Copy link

vercel bot commented Feb 4, 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 4, 2026 10:26am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 4, 2026 10:26am
npmx-lunaria Ignored Ignored Feb 4, 2026 10:26am

Request Review

@github-actions
Copy link

github-actions bot commented Feb 4, 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/zh-CN.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 4, 2026

📝 Walkthrough

Walkthrough

This pull request introduces package deprecation functionality with custom reasons. It adds a new Vue modal component for the deprecation workflow, integrates it into the package page to allow package owners to deprecate packages or versions, implements a new npm-client function to execute deprecation via the npm CLI, extends operation types and schemas to support the 'package:deprecate' operation, updates the server to handle this operation type, and provides localisation strings in multiple languages including English and Simplified Chinese.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description is a single-line reference to issue #40, which relates directly to the changeset implementing package deprecation functionality.
Linked Issues check ✅ Passed The changeset fully implements the objective from issue #40: package deprecation with custom reason support via the connector with appropriate UI, API, and i18n.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing package deprecation functionality: new modal component, integration in package page, CLI operations, schemas, types, and comprehensive i18n support.

✏️ 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.

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 4.54545% with 84 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
app/components/Package/DeprecatePackageModal.vue 5.55% 55 Missing and 13 partials ⚠️
app/pages/package/[...package].vue 0.00% 13 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

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: 3

🧹 Nitpick comments (1)
app/pages/package/[...package].vue (1)

1156-1169: Remove duplicate CSS classes.

The button has redundant inline-flex items-center (conflicting with flex) and w-full appearing twice in the class string.

🧹 Proposed fix
           <button
             type="button"
-            class="flex items-center justify-center w-full px-3 py-1.5 bg-bg-subtle rounded text-sm font-mono text-red-400 hover:text-red-500 transition-colors inline-flex items-center gap-1.5 w-full"
+            class="flex items-center justify-center gap-1.5 w-full px-3 py-1.5 bg-bg-subtle rounded text-sm font-mono text-red-400 hover:text-red-500 transition-colors"
             `@click`="deprecateModal?.open()"
           >

Comment on lines +46 to +48
const command = params.version
? `npm deprecate ${props.packageName}@${params.version} "${message}"`
: `npm deprecate ${props.packageName} "${message}"`
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Escape quotes in the deprecation message to prevent command parsing issues.

If a user enters a message containing double quotes (e.g., Use "package-x" instead), the generated command will have unbalanced quotes, potentially causing the CLI operation to fail or behave unexpectedly.

🛡️ Proposed fix
+    // Escape double quotes in message for shell safety
+    const escapedMessage = message.replace(/"/g, '\\"')
+
     const command = params.version
-      ? `npm deprecate ${props.packageName}@${params.version} "${message}"`
-      : `npm deprecate ${props.packageName} "${message}"`
+      ? `npm deprecate ${props.packageName}@${params.version} "${escapedMessage}"`
+      : `npm deprecate ${props.packageName} "${escapedMessage}"`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const command = params.version
? `npm deprecate ${props.packageName}@${params.version} "${message}"`
: `npm deprecate ${props.packageName} "${message}"`
// Escape double quotes in message for shell safety
const escapedMessage = message.replace(/"/g, '\\"')
const command = params.version
? `npm deprecate ${props.packageName}@${params.version} "${escapedMessage}"`
: `npm deprecate ${props.packageName} "${escapedMessage}"`

Comment on lines +75 to +76
deprecateError.value = completedOp.result?.stderr || t('deprecate.modal.failed')
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing i18n key for error fallback.

The key deprecate.modal.failed does not exist in any locale file. This will display the raw key string to users when an error occurs.

You need to either:

  1. Add a failed key under package.deprecation.modal in all locale files, or
  2. Use an existing key like t('common.try_again') or a hardcoded fallback.
🐛 Proposed fix (option 1 - use correct path and add key)
       } else {
-        deprecateError.value = completedOp.result?.stderr || t('deprecate.modal.failed')
+        deprecateError.value = completedOp.result?.stderr || t('package.deprecation.modal.failed')
       }

Then add to each locale file under package.deprecation.modal:

"failed": "Failed to deprecate package"

Comment on lines +81 to +83
} catch (err) {
deprecateError.value = err instanceof Error ? err.message : t('deprecate.modal.failed')
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Same missing i18n key in catch block.

This catch block also references the non-existent deprecate.modal.failed key.

🐛 Proposed fix
   } catch (err) {
-    deprecateError.value = err instanceof Error ? err.message : t('deprecate.modal.failed')
+    deprecateError.value = err instanceof Error ? err.message : t('package.deprecation.modal.failed')
   } finally {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (err) {
deprecateError.value = err instanceof Error ? err.message : t('deprecate.modal.failed')
} finally {
} catch (err) {
deprecateError.value = err instanceof Error ? err.message : t('package.deprecation.modal.failed')
} finally {

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.

add package deprecation with custom reason

1 participant