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

npm package name regex too restrictive #83

Open
lee-current-health opened this issue Nov 8, 2022 · 1 comment
Open

npm package name regex too restrictive #83

lee-current-health opened this issue Nov 8, 2022 · 1 comment

Comments

@lee-current-health
Copy link

The --name validator regex is too restrictive and will not let valid package names pass validation.

Presume it was a legacy versus current package name issue.

https://github.com/npm/validate-npm-package-name has a list of valid package name defined as:

Naming Rules

Below is a list of rules that valid npm package name should conform to.

package name length should be greater than zero
all the characters in the package name must be lowercase i.e., no uppercase or mixed case names are allowed
package name can consist of hyphens
package name must not contain any non-url-safe characters (since name ends up being part of a URL)
package name should not start with . or _
package name should not contain any spaces
package name should not contain any of the following characters: ~)('!*
package name cannot be the same as a node.js/io.js core module nor a reserved/blacklisted name. For example, the following names are invalid:
http
stream
node_modules
favicon.ico
package name length cannot exceed 214

I couldn't find this in the npm docs to reference.

Simplest change for my particular issue would be allowing the . in the name after the scope so that @scope/com.example.packageid passed the regex

^(@[a-z0-9-]+/)?[a-z0-9-.]+$

@mig8447
Copy link

mig8447 commented Jan 2, 2023

I agree, it doesn't even support dashes, although I just noticed that this is a Java Package ID which don't support dashes

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

No branches or pull requests

2 participants