package.json-validator icon indicating copy to clipboard operation
package.json-validator copied to clipboard

🐛 Bug: Add support for GitHub URLs in dependencies

Open DjDCH opened this issue 10 years ago • 3 comments

I'm currently trying to get my package.json valided before submiting a new package. However, the validation is faling since I'm trying to use GitHub URLs in my dependencies.

From the npm docs:

As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project".

However, if I use the following de

"dependencies": {
  "foo": "user/foo-project"
}

package.json-validator tell me that my package.json is not valid:

package.json is NOT valid
{ valid: false,
  errors: [ 'Invalid version range for dependency foo: user/foo-project' ] }

DjDCH avatar Apr 01 '14 00:04 DjDCH

The commit to fix this looks like it's been open for a while, we are currently working around it by adding the git://github.com/ prefix which works for some reason.

Documented here https://docs.npmjs.com/files/package.json#urls-as-dependencies

lukebatchelor avatar Nov 25 '16 00:11 lukebatchelor

Any update on this? I'm facing the same issue.

piranna avatar Jul 29 '23 11:07 piranna

Per https://docs.npmjs.com/cli/v10/configuring-npm/package-json#github-urls, shorthand GitHub URLs -with or without branch/commit/etc. specifiers- should be supported. It's a bug that they're not. Accepting PRs!

JoshuaKGoldberg avatar Mar 28 '24 12:03 JoshuaKGoldberg