iLemming
iLemming

Reputation: 36244

package.json dependency alternative source

Can you tell that specific dependency would be cloned from a different source not npmjs? Something maybe like this:

"dependencies": {
    "foo": 
     { 
       "ver":">= 2.0"
       "src":"https://github.com/foo/foo.git"
     }
 }

Upvotes: 0

Views: 665

Answers (2)

alex
alex

Reputation: 12275

You can define github dependency like this:

"dependencies": {
    "foo": "username/foo"
}

It's not possible to specify semver ranges for github packages yet. If you need that, you can use yapm instead, and write syntax like this:

"dependencies": {
    "foo": "username/foo@>=2"
}

Upvotes: 1

nightire
nightire

Reputation: 1371

If what you want is on the Github or a valid git address, you can

"dependencies": { "express": "visionmedia/express" }

or

"dependencies": { "express": "git://github.com/visionmedia/express.git#commit-ish" }

where the #commit-ish is the commit hash ID which will helps you to specify version number.

Take a look on Official guides: https://www.npmjs.org/doc/json.html#dependencies, you can do more than you expected.

Upvotes: 2

Related Questions