Skip to content

Commit

Permalink
Default to ^ operator on --save
Browse files Browse the repository at this point in the history
This fix brings us inline with how npm installs work and also brings us
more inline with how semver is supposed to be used.

Fixes #2144
  • Loading branch information
samccone committed Jan 11, 2016
1 parent d4fd719 commit d06af7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/core/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ Manager.prototype._onFetchSuccess = function (decEndpoint, canonicalDir, pkgMeta

// If the package is not targetable, flag it
// It will be needed later so that untargetable endpoints
// will not get * converted to ~version
// will not get * converted to ^version
if (!isTargetable) {
decEndpoint.untargetable = true;
}
Expand Down Expand Up @@ -595,7 +595,7 @@ Manager.prototype._dissect = function () {
// If they are not, the resolver is incapable of handling targets
semvers.forEach(function (decEndpoint) {
if (decEndpoint.newly && decEndpoint.target === '*' && !decEndpoint.untargetable) {
decEndpoint.target = '~' + decEndpoint.pkgMeta.version;
decEndpoint.target = '^' + decEndpoint.pkgMeta.version;
decEndpoint.originalTarget = '*';
}
});
Expand Down

0 comments on commit d06af7a

Please sign in to comment.