-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves issue#12, check non-local remotes when semver not satisfied
- Loading branch information
clintwood (Office)
committed
Jul 20, 2014
1 parent
33568e8
commit 2dceb3b
Showing
1 changed file
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,15 +119,28 @@ Resolver.prototype.resolveSemverLocally = function (branch, name, ref) { | |
*/ | ||
|
||
Resolver.prototype.resolveSemverRemotely = function* (branch, name, ref) { | ||
var remote = yield* this.remote.resolve(branch.resolvedRemotes, name); | ||
if (!remote) throw new Error('no remote found for dependency "' + name + '".'); | ||
var versions = yield* remote.versions(name); | ||
var version = semver.maxSatisfying(versions, ref); | ||
if (version) return version; | ||
var remotes = branch.resolvedRemotes; | ||
// try resolve using resolvedRemotes but | ||
// special case 'local' if unsuccessful | ||
// i.e. if 'ref' is not satisfied by 'local' afford | ||
// non-local resolvedRemotes to try to resolve it | ||
do { | ||
var remote = yield* this.remote.resolve(remotes, name); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
clintwood
Contributor
|
||
if (!remote) throw new Error('no remote found for dependency "' + name + '".'); | ||
var versions = yield* remote.versions(name); | ||
var version = semver.maxSatisfying(versions, ref); | ||
if (version) return version; | ||
remotes = remotes.filter(nonLocal); | ||
} while (remote.name === 'local'); | ||
|
||
// no satisfying versions! | ||
// this is an error for semver ranges | ||
if (ref !== '*') throw new Error('invalid semver range "' + ref + '" for "' + name + '"'); | ||
// to do: use the actual "main" branch | ||
// ex. gh-pages | ||
return 'master'; | ||
} | ||
|
||
function nonLocal(remote) { | ||
return (remote !== 'local'); | ||
} |
don't understand the comment and why
ref
is not passed here tothis.remote.resolv()