Repository: bower/bower
Pull request #2316 (2016-06-29 16:18:13)

Check if version is valid
semver.neq throws error when version is not valid. It should be catched and logged or simply ignored by this check. I've been using npm-check-updates package and it crashes because of this:

```
C:\DEV>ncu -m bower
Unhandled rejection TypeError: Invalid Version: 2.2-jsdw
    at new SemVer (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\semver\semver.js:273:11)
    at compare (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\semver\semver.js:460:10)
    at Object.neq (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\semver\semver.js:504:10)
    at GitHubResolver.GitResolver._savePkgMeta (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\core\resolvers
\GitResolver.js:209:56)
    at GitHubResolver._savePkgMeta (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\core\resolvers\GitHubResol
ver.js:134:53)
    at _fulfilled (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:834:54)
    at self.promiseDispatch.done (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:863:30)
    at Promise.promise.promiseDispatch (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:79
6:13)
    at C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:604:44
    at runSingle (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:137:13)
    at flush (C:\Users\jamat\AppData\Roaming\npm\node_modules\bower\lib\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
```



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c421a6e5..6f8afe3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
 # Changelog
 
+## Unreleased
+
+- Change default shorthand resolver for github from `git://` to `https://`
+- Allow to type the entire version when conflict occured, #2243
+- Allow `owner/reponame` shorthand for registering components, #2248
+- Allow single-char repo names and package names, #2249
+- Make `bower version` no longer honor `version` in bower.json, #2232
+- Add `postinstall` hook, #2252
+- Allow for `@` instead of `#` for `install` and `info` commands, #2322
+- Upgrade all bundled modules
+
 ## 1.7.9 - 2016-04-05
 
 - Show warnings for invalid bower.json fields
@@ -83,7 +94,7 @@ https://github.com/npm/npm/issues/11227
 - Update bower config
   - Loads the .bowerrc file from the cwd specified on the command line
   - Allow the use of environment variables in .bowerrc ([#41](https://github.com/bower/config/issues/41))
-	- Allow for array notation in ENV variables ([#44](https://github.com/bower/config/issues/44))
+  - Allow for array notation in ENV variables ([#44](https://github.com/bower/config/issues/44))
 
 ## 1.6.9 - 2015-12-04
 
diff --git a/README.md b/README.md
index c46802fd..45c838f0 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,6 @@
 [![Windows CI](https://img.shields.io/appveyor/ci/bower/bower/master.svg)](https://ci.appveyor.com/project/bower/bower)
 [![Coverage Status](https://img.shields.io/coveralls/bower/bower.svg)](https://coveralls.io/r/bower/bower?branch=master)
 [![Discord chat](https://img.shields.io/badge/discord-join%20chat%20%E2%86%92-brightgreen.svg?style=flat)](https://discord.gg/0fFM7QF0KpZRh2cY)
-[![Issue Stats](http://issuestats.com/github/bower/bower/badge/pr?style=flat)](http://issuestats.com/github/bower/bower)
-[![Issue Stats](http://issuestats.com/github/bower/bower/badge/issue?style=flat)](http://issuestats.com/github/bower/bower)
 
 <img align="right" height="300" src="http://bower.io/img/bower-logo.png">
 
diff --git a/lib/commands/info.js b/lib/commands/info.js
index 850360ef..28cac378 100644
--- a/lib/commands/info.js
+++ b/lib/commands/info.js
@@ -9,6 +9,9 @@ function info(logger, endpoint, property, config) {
         return;
     }
 
+    // handle @ as version divider
+    endpoint = endpoint.replace('@', '#');
+
     var repository;
     var decEndpoint;
 
diff --git a/lib/commands/install.js b/lib/commands/install.js
index c3d0489e..6e6b6fc5 100644
--- a/lib/commands/install.js
+++ b/lib/commands/install.js
@@ -16,6 +16,8 @@ function install(logger, endpoints, options, config) {
     // Convert endpoints to decomposed endpoints
     endpoints = endpoints || [];
     decEndpoints = endpoints.map(function (endpoint) {
+        // handle @ as version divider
+        endpoint = endpoint.replace('@', '#');
         return endpointParser.decompose(endpoint);
     });
 
diff --git a/lib/core/resolvers/GitResolver.js b/lib/core/resolvers/GitResolver.js
index 3c161a3f..9f4917f6 100644
--- a/lib/core/resolvers/GitResolver.js
+++ b/lib/core/resolvers/GitResolver.js
@@ -206,7 +206,7 @@ GitResolver.prototype._savePkgMeta = function (meta) {
         version = semver.clean(this._resolution.tag);
 
         // Warn if the package meta version is different than the resolved one
-        if (typeof meta.version === 'string' && semver.neq(meta.version, version)) {
+        if (typeof meta.version === 'string' && semver.valid(meta.version) && semver.neq(meta.version, version)) {
             this._logger.warn('mismatch', 'Version declared in the json (' + meta.version + ') is different than the resolved one (' + version + ')', {
                 resolution: this._resolution,
                 pkgMeta: meta
diff --git a/lib/core/resolvers/pluginResolverFactory.js b/lib/core/resolvers/pluginResolverFactory.js
index 799203c8..d751d1f5 100644
--- a/lib/core/resolvers/pluginResolverFactory.js
+++ b/lib/core/resolvers/pluginResolverFactory.js
@@ -109,7 +109,7 @@ function pluginResolverFactory(resolverFactory, bower) {
                             throw createError('Resolver did not provide releases of package.');
                         }
 
-                        var releases = this._releases = result;
+                        var releases = that._releases = result;
 
                         var versions = releases.filter(function (target) {
                             return semver.clean(target.version);
diff --git a/package.json b/package.json
index b1331c86..0fda14cc 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
   "dependencies": {
     "abbrev": "^1.0.5",
     "archy": "1.0.0",
-    "bower-config": "^1.3.1",
+    "bower-config": "^1.4.0",
     "bower-endpoint-parser": "^0.2.2",
     "bower-json": "^0.8.1",
     "bower-logger": "^0.2.2",
diff --git a/packages/bower-config/package.json b/packages/bower-config/package.json
index cc1f3f91..feac4880 100644
--- a/packages/bower-config/package.json
+++ b/packages/bower-config/package.json
@@ -4,7 +4,7 @@
   "description": "The Bower config reader and writer.",
   "author": "Twitter",
   "license": "MIT",
-  "repository": "bower/config",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-config",
   "main": "lib/Config",
   "homepage": "http://bower.io",
   "engines": {
diff --git a/packages/bower-endpoint-parser/package.json b/packages/bower-endpoint-parser/package.json
index aa726064..145e25c5 100644
--- a/packages/bower-endpoint-parser/package.json
+++ b/packages/bower-endpoint-parser/package.json
@@ -9,10 +9,7 @@
       "url": "https://github.com/bower/endpoint-parser/blob/master/LICENSE"
     }
   ],
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/bower/endpoint-parser.git"
-  },
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-endpoint-parser",
   "main": "index.js",
   "engines": {
     "node": ">=0.8.0"
diff --git a/packages/bower-json/package.json b/packages/bower-json/package.json
index a145b194..e6187cbb 100644
--- a/packages/bower-json/package.json
+++ b/packages/bower-json/package.json
@@ -4,7 +4,7 @@
   "description": "Read bower.json files with semantics, normalisation, defaults and validation",
   "author": "Twitter",
   "license": "MIT",
-  "repository": "bower/json",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-json",
   "main": "lib/json",
   "engines": {
     "node": ">=0.10.0"
diff --git a/packages/bower-logger/package.json b/packages/bower-logger/package.json
index a3c78190..26eed872 100644
--- a/packages/bower-logger/package.json
+++ b/packages/bower-logger/package.json
@@ -9,7 +9,7 @@
       "url": "https://github.com/bower/logger/blob/master/LICENSE"
     }
   ],
-  "repository": "bower/logger",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-logger",
   "main": "lib/Logger",
   "engines": {
     "node": ">=0.10.0"
diff --git a/packages/bower-registry-client/package.json b/packages/bower-registry-client/package.json
index e7eb5658..74c206fa 100644
--- a/packages/bower-registry-client/package.json
+++ b/packages/bower-registry-client/package.json
@@ -4,7 +4,7 @@
   "description": "Provides easy interaction with the Bower registry",
   "author": "Twitter",
   "license": "MIT",
-  "repository": "bower/registry-client",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-registry-client",
   "main": "Client",
   "engines": {
     "node": ">=0.10.0"


Test patch:
diff --git a/test/commands/info.js b/test/commands/info.js
index 8dcc6469..60e39135 100644
--- a/test/commands/info.js
+++ b/test/commands/info.js
@@ -49,4 +49,17 @@ describe('bower info', function () {
             });
         });
     });
+    it('should handle @ as a divider', function () {
+        return helpers.run(info, [mainPackage.path + '@0.1.3']).spread(function (results) {
+            expect(results).to.eql(
+                {
+                    name: 'package',
+                    version: '0.1.3',
+                    homepage: 'http://bower.io',
+                    description: 'Hello world! Hello!'
+                }
+            );
+        });
+
+    });
 });
diff --git a/test/commands/install.js b/test/commands/install.js
index e37059b2..c35b6674 100644
--- a/test/commands/install.js
+++ b/test/commands/install.js
@@ -726,4 +726,13 @@ describe('bower install', function () {
             expect(tempDir.read(path.join('bower_components', 'package', 'package.tar'))).to.contain('test');
         });
     });
+    it('should handle @ as a divider', function () {
+        return helpers.run(install, [
+            ['empty@1.0.1'], {
+                save: true
+            }
+        ]).then(function () {
+            expect(tempDir.readJson('bower.json').dependencies).to.eql({empty: '1.0.1'});
+        });
+    });
 });