Compare commits

...

16 Commits

Author SHA1 Message Date
Adam Stankiewicz
bda400634c Bump to 1.8.0 2016-11-07 10:53:30 +01:00
Adam Stankiewicz
b01243ac3c Fix eslint issues 2016-11-07 10:47:29 +01:00
Adam Stankiewicz
89902a6919 Mark release in changelog 2016-11-07 10:46:10 +01:00
Adam Stankiewicz
80308a41a6 Update changelog 2016-11-07 10:34:39 +01:00
Adam Stankiewicz
47cc2262e1 Download tar archives from https://github when possible (#2263) 2016-11-07 02:33:43 +01:00
Guillermo Ignacio Enriquez Gutierrez
f7c5154490 Fix ssl handling by not setting GIT_SSL_NO_VERIFY=false (#2361) 2016-11-07 01:50:57 +01:00
Ali MoezGholami
cba4b2a4cd Allow for removing components with url instead of name (#2368) 2016-11-07 01:48:41 +01:00
Leo.liang
bdabf6a4e6 Show in warning message location of malformed bower.json (#2357) 2016-11-07 01:29:17 +01:00
GvS
7896224384 Improve handling of non-semver versions in git resolver (#2316) 2016-11-07 01:27:14 +01:00
Johannes Faigle
3209cda975 docs: Update package repository information (#2351) 2016-11-07 01:21:27 +01:00
Vytautas Jakutis
38501a0b93 Fix handling of cached releases pluginResolverFactory (#2356) 2016-11-07 01:19:41 +01:00
Adam Stankiewicz
e60d236b25 Add bower-config changes to changelog 2016-11-06 23:04:07 +01:00
Adam Stankiewicz
044896e708 Bump bower-config to 1.4.0 2016-11-06 23:03:56 +01:00
Adam Stankiewicz
fc4c260de4 Update changelog 2016-11-06 22:56:42 +01:00
Adam Stankiewicz
d405917b4a Remove non-working issue stats 2016-07-05 11:16:26 +02:00
Martin Page
22bbb3fcaf Allow @ to be used as a divider with cli: install and info. (#2322) 2016-07-04 23:31:06 +02:00
19 changed files with 109 additions and 33 deletions

View File

@@ -1,5 +1,22 @@
# Changelog
## 1.8.0 - 2016-11-07
- Download tar archives from GitHub when possible (#2263)
- Change default shorthand resolver for github from `git://` to `https://`
- Fix ssl handling by not setting GIT_SSL_NO_VERIFY=false (#2361)
- Allow for removing components with url instead of name (#2368)
- Show in warning message location of malformed bower.json (#2357)
- Improve handling of non-semver versions in git resolver (#2316)
- Fix handling of cached releases pluginResolverFactory (#2356)
- 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 +100,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

View File

@@ -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">

View File

@@ -9,6 +9,9 @@ function info(logger, endpoint, property, config) {
return;
}
// handle @ as version divider
endpoint = endpoint.replace('@', '#');
var repository;
var decEndpoint;

View File

@@ -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);
});

View File

@@ -213,6 +213,20 @@ Project.prototype.update = function (names, options) {
});
};
function resolveUrlNames(names, flattened)
{
for (var i = 0; i < names.length; i++)
if (! flattened[names[i]])
{
var url = names[i].trim().replace(/\/$/, '');
var packName;
for (packName in flattened)
if (! ( !flattened[packName].source))
if (url == flattened[packName].source.trim().replace(/\/$/, ''))
names[i] = packName;
}
}
Project.prototype.uninstall = function (names, options) {
var that = this;
var packages = {};
@@ -230,6 +244,7 @@ Project.prototype.uninstall = function (names, options) {
// Fill in the packages to be uninstalled
.spread(function (json, tree, flattened) {
var promise = Q.resolve();
resolveUrlNames(names, flattened);
names.forEach(function (name) {
var decEndpoint = flattened[name];

View File

@@ -29,9 +29,6 @@ function GitHubResolver(decEndpoint, config, logger) {
this._source += '.git';
}
// Check if it's public
this._public = mout.string.startsWith(this._source, 'git://');
// Use https:// rather than git:// if on a proxy
if (this._config.proxy || this._config.httpsProxy) {
this._source = this._source.replace('git://', 'https://');
@@ -49,14 +46,10 @@ mout.object.mixIn(GitHubResolver, GitRemoteResolver);
// -----------------
GitHubResolver.prototype._checkout = function () {
// Only fully works with public repositories and tags
// Could work with https/ssh protocol but not with 100% certainty
if (!this._public || !this._resolution.tag) {
return GitRemoteResolver.prototype._checkout.call(this);
}
var msg;
var tarballUrl = 'https://github.com/' + this._org + '/' + this._repo + '/archive/' + this._resolution.tag + '.tar.gz';
var name = this._resolution.tag || this._resolution.branch || this._resolution.commit;
var tarballUrl = 'https://github.com/' + this._org + '/' + this._repo + '/archive/' + name + '.tar.gz';
var file = path.join(this._tempDir, 'archive.tar.gz');
var reqHeaders = {};
var that = this;
@@ -121,7 +114,6 @@ GitHubResolver.prototype._checkout = function () {
return that._cleanTempDir()
.then(GitRemoteResolver.prototype._checkout.bind(that));
});
};

View File

@@ -26,8 +26,18 @@ function GitResolver(decEndpoint, config, logger) {
// anyway
mkdirp.sync(config.storage.empty);
process.env.GIT_TEMPLATE_DIR = config.storage.empty;
process.env.GIT_SSL_NO_VERIFY = (!config.strictSsl).toString();
process.env.GIT_TERMINAL_PROMPT = config.interactive ? '1' : '0';
if (!config.strictSsl) {
process.env.GIT_SSL_NO_VERIFY = 'true';
}
if (!config.interactive) {
process.env.GIT_TERMINAL_PROMPT = '0';
if (!process.env.SSH_ASKPASS) {
process.env.SSH_ASKPASS = 'echo';
}
}
Resolver.call(this, decEndpoint, config, logger);
@@ -206,7 +216,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

View File

@@ -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);

View File

@@ -19,7 +19,9 @@ function readJson(file, options) {
if (options.logger) {
var issues = bowerJson.getIssues(json);
if (issues.warnings.length > 0) {
options.logger.warn('invalid-meta', 'for:' + jsonFile);
}
issues.warnings.forEach(function (warning) {
options.logger.warn('invalid-meta', warning);
});

View File

@@ -1,6 +1,6 @@
{
"name": "bower",
"version": "1.7.9",
"version": "1.8.0",
"description": "The browser package manager",
"author": "Twitter",
"license": "MIT",
@@ -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",

View File

@@ -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": {

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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!'
}
);
});
});
});

View File

@@ -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'});
});
});
});

View File

@@ -99,4 +99,21 @@ describe('bower uninstall', function () {
});
});
it('removes a project with url from absolute path', function () {
var targetPath = path.resolve(tempDir.path, 'other_directory/underscore');
mkdirp.sync(targetPath);
fs.writeFileSync(path.join(targetPath, '.bower.json'), '{ "name": "underscore", "_source": "git://github.com/user/repo.git" }');
return helpers.run(uninstall, [['git://github.com/user/repo.git'], undefined, {
cwd: tempDir.path,
directory: path.resolve(tempDir.path, 'other_directory'),
interactive: true
}])
.then(function () {
expect(function () {
fs.statSync(targetPath);
}).to.throwException(/no such file or directory/);
});
});
});

View File

@@ -50,16 +50,17 @@ describe('GitResolver', function () {
expect(process.env).to.not.have.property('GIT_SSL_NO_VERIFY');
resolver = new GitResolver(decEndpoint, defaultConfig(), logger);
expect(process.env).to.have.property('GIT_SSL_NO_VERIFY', 'false');
delete process.env.GIT_SSL_NO_VERIFY;
expect(process.env).to.not.have.property('GIT_SSL_NO_VERIFY');
resolver = new GitResolver(decEndpoint, defaultConfig({strictSsl: false}), logger);
expect(process.env).to.have.property('GIT_SSL_NO_VERIFY', 'true');
delete process.env.GIT_SSL_NO_VERIFY;
// git only checks the existence of GIT_SSL_NO_VERIFY.
// git does NOT check whether is true of false.
// Hence not exporting GIT_SSL_NO_VERIFY is effectively equivalent to 'false'
resolver = new GitResolver(decEndpoint, defaultConfig({strictSsl: true}), logger);
expect(process.env).to.have.property('GIT_SSL_NO_VERIFY', 'false');
delete process.env.GIT_SSL_NO_VERIFY;
expect(process.env).to.not.have.property('GIT_SSL_NO_VERIFY');
});
});