Skip to content

fix: correct org name regexp#1785

Merged
serhalp merged 3 commits intonpmx-dev:mainfrom
alexdln:fix/update-org-name-rule
Mar 1, 2026
Merged

fix: correct org name regexp#1785
serhalp merged 3 commits intonpmx-dev:mainfrom
alexdln:fix/update-org-name-rule

Conversation

@alexdln
Copy link
Member

@alexdln alexdln commented Mar 1, 2026

🔗 Linked issue

Related post - bsky.app

🧭 Context

We had a very basic rule that was much stricter than what is available in npm

In npm [as I found] only two rules - url-safe symbols and does not start with a dot:

https://www.npmjs.com/org/~test24214.

https://www.npmjs.com/org/-ex~-

📚 Description

Updated regexp to match npm rules

image

@vercel
Copy link

vercel bot commented Mar 1, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 1, 2026 4:11pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 1, 2026 4:11pm
npmx-lunaria Ignored Ignored Mar 1, 2026 4:11pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

📝 Walkthrough

Walkthrough

The organisation packages endpoint's validation pattern was changed: the NPM_ORG_NAME_RE regex was replaced with ^[\w~-][\w.~-]*$. The new pattern disallows a leading dot but permits word characters, underscores, dots, tildes and hyphens in subsequent positions. Other validation and error-handling logic around this check remain unchanged.

Suggested reviewers

  • danielroe
  • serhalp
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description is directly related to the changeset, explaining the motivation for updating the npm org name validation regex to match npm's actual rules.

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

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

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 and usage tips.

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 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: 2


ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a4563b and 787be6f.

📒 Files selected for processing (1)
  • server/api/registry/org/[org]/packages.get.ts

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.

🧹 Nitpick comments (1)
server/api/registry/org/[org]/packages.get.ts (1)

4-4: Fix typo and wording in the validation comment.

Line 4 contains spelling/wording issues (url-sage symbold) that reduce readability.

✏️ Suggested wording
-// Validation pattern for npm org names - url-sage symbold and not start with a dot (incl. ~test24214. or -ex~-)
+// Validation pattern for npm org names: URL-safe symbols, and must not start with a dot (e.g. ~test24214., -ex~-)

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 787be6f and 6338c95.

📒 Files selected for processing (1)
  • server/api/registry/org/[org]/packages.get.ts

@serhalp serhalp added this pull request to the merge queue Mar 1, 2026
Merged via the queue into npmx-dev:main with commit 2215a36 Mar 1, 2026
18 checks passed
@alexdln alexdln deleted the fix/update-org-name-rule branch March 1, 2026 17:40
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.

2 participants