Compare commits

...

32 Commits

Author SHA1 Message Date
Adam Stankiewicz
febf300fdd Update travis badges and remove old files 2020-04-25 02:22:40 +02:00
Adam Stankiewicz
0eab022654 Last fixes 2020-04-25 01:59:53 +02:00
Adam Stankiewicz
c190c74df9 Remove unncecessary dev dependencies 2020-04-25 01:54:35 +02:00
Adam Stankiewicz
6137633412 Fix windows tests 2020-04-25 01:52:06 +02:00
Adam Stankiewicz
c2cb4f7c48 Add node 14.x 2020-04-25 01:04:15 +02:00
Adam Stankiewicz
225dc0b69f Do not check indent with eslint 2020-04-25 00:40:32 +02:00
Adam Stankiewicz
e0825d1f47 Fix tests 2020-04-25 00:38:06 +02:00
Adam Stankiewicz
b4ecfa5a96 Remove grunt 2020-04-25 00:26:18 +02:00
Adam Stankiewicz
3321382c62 Use existing grunt 2020-04-24 22:51:50 +02:00
Adam Stankiewicz
e4a4cd1ba0 Change order 2020-04-24 20:58:35 +02:00
Adam Stankiewicz
7901011d34 Add github workflows 2020-04-24 20:56:12 +02:00
Adam Stankiewicz
f313129e85 fix 2019-12-10 16:48:54 +01:00
Adam Stankiewicz
fb5a798920 fix 2019-12-10 16:38:50 +01:00
Adam Stankiewicz
6104718892 fix 2019-12-10 16:32:19 +01:00
Adam Stankiewicz
021736f7c5 Update 2019-12-10 16:23:09 +01:00
Adam Stankiewicz
66bd9d1fc4 Update appveyor tests 2019-12-10 16:15:20 +01:00
Adam Stankiewicz
07d40e7fbf Fix 2019-12-10 16:13:01 +01:00
Adam Stankiewicz
16b651139a Fix tests 2019-12-10 16:03:59 +01:00
Adam Stankiewicz
b47ce33e9e Fix 2019-12-10 15:41:29 +01:00
Adam Stankiewicz
4996448d68 Fix tests 2019-12-10 15:32:52 +01:00
Adam Stankiewicz
da1baa055f Fix initialization issue 2019-12-10 15:09:15 +01:00
Adam Stankiewicz
3e294789b5 Fix build 2019-12-10 15:04:54 +01:00
Adam Stankiewicz
45408e9589 Fix 2019-12-10 14:56:36 +01:00
Adam Stankiewicz
cbb9b4415e Try to fix build 2019-12-10 14:52:57 +01:00
Adam Stankiewicz
e3328a4034 Test subpackages on travis and appveyor 2019-12-10 13:01:45 +01:00
dependabot[bot]
4e68c23c87 Bump stringstream from 0.0.5 to 0.0.6 (#2553)
Bumps [stringstream](https://github.com/mhart/StringStream) from 0.0.5 to 0.0.6.
- [Release notes](https://github.com/mhart/StringStream/releases)
- [Commits](https://github.com/mhart/StringStream/compare/v0.0.5...v0.0.6)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-10 12:59:40 +01:00
dependabot[bot]
fcc02c4200 Bump handlebars from 4.0.10 to 4.1.2 (#2552)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.10 to 4.1.2.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.10...v4.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-10 12:33:10 +01:00
dependabot[bot]
d24e7be811 Bump mime from 1.4.0 to 1.6.0 (#2551)
Bumps [mime](https://github.com/broofa/node-mime) from 1.4.0 to 1.6.0.
- [Release notes](https://github.com/broofa/node-mime/releases)
- [Changelog](https://github.com/broofa/node-mime/blob/v1.6.0/CHANGELOG.md)
- [Commits](https://github.com/broofa/node-mime/compare/v1.4.0...v1.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-10 11:41:29 +01:00
dependabot[bot]
746fd3a669 Bump sshpk from 1.13.1 to 1.16.1 (#2550)
Bumps [sshpk](https://github.com/joyent/node-sshpk) from 1.13.1 to 1.16.1.
- [Release notes](https://github.com/joyent/node-sshpk/releases)
- [Commits](https://github.com/joyent/node-sshpk/compare/v1.13.1...v1.16.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-10 09:35:48 +01:00
dependabot[bot]
031c7731a4 Bump extend from 3.0.1 to 3.0.2 (#2549)
Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/justmoon/node-extend/releases)
- [Changelog](https://github.com/justmoon/node-extend/blob/master/CHANGELOG.md)
- [Commits](https://github.com/justmoon/node-extend/compare/v3.0.1...v3.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-10 09:35:31 +01:00
Adam Stankiewicz
fa62654b9c Test node 10 and 12 on Windows 2019-12-10 09:26:12 +01:00
Adam Stankiewicz
fd2d448b7e Test node 10 and 12 on CI (#2548) 2019-12-10 08:53:36 +01:00
52 changed files with 1202 additions and 3340 deletions

View File

@@ -1,46 +0,0 @@
# http://www.appveyor.com/docs/appveyor-yml
# Set build version format here instead of in the admin panel.
version: "{build}"
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
# Test against these versions of Node.js.
environment:
matrix:
- nodejs_version: "0.10"
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "9"
# Finish on first failed build
matrix:
fast_finish: true
# Install node, display versions, install dependencies
install:
- ps: Install-Product node 8
- node --version && npm --version
- git --version && svn --version
- npm install -g yarn grunt
- yarn
- ps: Install-Product node $env:nodejs_version
# Post-install test scripts.
test_script:
- cmd: npm run ci
# Make clone much faster
shallow_clone: true
# Disable Visual Studio build and deploy
build: off
deploy: off
# Cache node modules, and refresh if package.json changes
cache:
- "%LOCALAPPDATA%\\Yarn"

6
.eslintignore Normal file
View File

@@ -0,0 +1,6 @@
node_modules
test/assets
test/reports
test/sample
test/tmp
packages/bower-logger/test

View File

@@ -19,7 +19,6 @@
"comma-spacing": 2,
"quote-props": [2, "as-needed"],
"quotes": [2, "single", "avoid-escape"],
"indent": [2, 4],
"no-cond-assign": [ 2, "except-parens" ],
"no-debugger": 2,
"no-dupe-args": 2,

62
.github/workflows/nodejs.yml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: build
on:
push:
branches:
- master
pull_request:
branches:
- '**'
jobs:
test:
name: Node v${{ matrix.node-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# https://github.com/actions/setup-node/issues/27
node-version: [0.10.x, 0.12.x, 4.x, 6.x, 8.x, 10.x, 12.x, 14.x]
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set git config
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
if: runner.os == 'Windows'
- uses: actions/checkout@v2
- name: install
run: yarn
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: lint
run: npm run lint
- name: bower tests
run: npm test
env:
CI: true
- name: bower-logger tests
run: (cd packages/bower-logger && npm install && npm test)
env:
CI: true
- name: bower-config tests
run: (cd packages/bower-config && npm install && npm test)
env:
CI: true
- name: bower-endpoint-parser tests
run: (cd packages/bower-endpoint-parser && npm install && npm test)
env:
CI: true
- name: bower-json tests
run: (cd packages/bower-json && npm install && npm test)
env:
CI: true
- name: bower-registry-client tests
run: (cd packages/bower-registry-client && npm install && npm test)
env:
CI: true

View File

@@ -1,2 +1,4 @@
**/node_modules/**
**/test/assets/**
**/bower_components/**
test/sample

View File

@@ -1,43 +0,0 @@
sudo: false
language: node_js
# Use node 8 for build
node_js:
- "8"
# Then test with specific node version
env:
- TEST_NODE_VERSION="0.10"
- TEST_NODE_VERSION="0.12"
- TEST_NODE_VERSION="4"
- TEST_NODE_VERSION="6"
- TEST_NODE_VERSION="8"
- TEST_NODE_VERSION="9"
before_install:
- node --version
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.5.1
- export PATH=$HOME/.yarn/bin:$PATH
cache:
yarn: true
install:
- yarn
- nvm install $TEST_NODE_VERSION
- npm install -g grunt
os:
- osx
- linux
matrix:
fast_finish: true
allow_failures:
- os: osx
script:
- nvm use $TEST_NODE_VERSION
- node --version && npm --version && git --version && svn --version | head -n 1
- grunt travis

View File

@@ -1,250 +0,0 @@
var tmp = require('tmp');
var childProcess = require('child_process');
var arraydiff = require('arr-diff');
var fs = require('fs');
var wrench = require('wrench');
var inquirer = require('inquirer');
var path = require('path');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
eslint: {
files: [
'Gruntfile.js',
'bin/*',
'lib/**/*.js',
'test/**/*.js',
'!test/assets/**/*',
'!test/reports/**/*',
'!test/sample/**/*',
'!test/tmp/**/*'
]
},
simplemocha: {
options: {
reporter: 'spec',
timeout: '15000'
},
full: {
src: ['test/test.js']
},
short: {
options: {
reporter: 'dot'
},
src: ['test/test.js']
}
},
exec: {
assets: {
command: 'node test/packages.js && node test/packages-svn.js'
},
'assets-force': {
command:
'node test/packages.js --force && node test/packages-svn.js --force'
},
cover: {
command:
'node node_modules/istanbul/lib/cli.js cover --dir ./test/reports node_modules/mocha/bin/_mocha -- --timeout 30000 -R dot test/test.js'
},
coveralls: {
command: 'npm run coveralls < test/reports/lcov.info',
exitCodes: [0, 1, 2, 3] // Alow for failure for coverage report
}
},
watch: {
files: ['<%= eslint.files %>'],
tasks: ['eslint', 'simplemocha:short']
}
});
grunt.registerTask('assets', ['exec:assets-force']);
grunt.registerTask('test', ['eslint', 'exec:assets', 'simplemocha:full']);
grunt.registerTask('cover', 'exec:cover');
grunt.registerTask('travis', [
'eslint',
'exec:assets',
'exec:cover',
'exec:coveralls'
]);
grunt.registerTask('default', 'test');
grunt.task.registerTask(
'publish',
'Perform final checks and publish Bower',
function() {
var npmVersion = JSON.parse(
childProcess.execSync('npm version --json').toString()
).npm.split('.');
var npmMajor = parseInt(npmVersion[0], 10);
var npmMinor = parseInt(npmVersion[1], 10);
var jsonPackage = require('./package');
if (npmMajor !== 3 || npmMinor < 5) {
grunt.log.writeln(
'You need to use at npm@3.5 to publish bower.'
);
grunt.log.writeln(
'It is because npm 2.x produces too long paths that Windows does not handle and newer npm drops lib/node_modules'
);
grunt.log.writeln('Please upgrade it: npm install -g npm@3');
process.exit(1);
}
if (
childProcess
.execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.trim() !== 'master'
) {
grunt.log.writeln(
'You need to release bower from the "master" branch'
);
process.exit(1);
}
if (process.env.SKIP_TESTS !== '1') {
grunt.log.writeln('Reinstalling dependencies...');
childProcess.execSync('rm -rf node_modules && yarn', {
stdio: [0, 1, 2]
});
grunt.log.writeln('Running test suite...');
childProcess.execSync('yarn test', { stdio: [0, 1, 2] });
}
var dir = tmp.dirSync().name;
wrench.copyDirSyncRecursive(__dirname, dir, {
forceDelete: true,
include: function(path) {
return !path.match(/node_modules|\.git|test/);
}
});
grunt.log.writeln('Installing production dependencies...');
childProcess.execSync('yarn --production', {
cwd: dir,
stdio: [0, 1, 2]
});
delete jsonPackage.dependencies;
delete jsonPackage.devDependencies;
delete jsonPackage.scripts;
fs.writeFileSync(
path.resolve(dir, 'package.json'),
JSON.stringify(jsonPackage, null, ' ') + '\n'
);
grunt.log.writeln('Moving node_modules to lib directory...');
wrench.copyDirSyncRecursive(
path.resolve(dir, 'node_modules'),
path.resolve(dir, 'lib', 'node_modules')
);
wrench.rmdirSyncRecursive(path.resolve(dir, 'node_modules'));
grunt.log.writeln('Testing bower on sample project...');
childProcess.execSync(
'cd test/sample && rm -rf bower_components && ' +
dir +
'/bin/bower install --force',
{ stdio: [0, 1, 2] }
);
var expectedPackages = (
'SHA-1 ace-builds almond angular angular-animate angular-bootstrap angular-charts angular-contenteditable ' +
'angular-deckgrid angular-fullscreen angular-gravatar angular-hotkeys angular-local-storage angular-marked ' +
'angular-moment angular-sanitize angular-touch angular-ui-router angular-ui-sortable ' +
'angulartics asEvented bootstrap coffee-script d3 es6-shim font-awesome howler jquery ' +
'jquery-ui jquery-waypoints js-beautify lodash lz-string marked moment ng-file-upload peerjs ' +
'requirejs restangular slimScroll slimScrollHorizontal venturocket-angular-slider'
).split(' ');
var installedPackages = fs.readdirSync(
'./test/sample/bower_components'
);
var installedDiff = arraydiff(expectedPackages, installedPackages);
if (installedDiff.length > 0) {
grunt.log.writeln(
'ERROR. Some packages were not installed by bower: '
);
grunt.log.writeln(installedDiff.join(', '));
process.exit(1);
}
grunt.log.writeln('\nBower production bundle installed in:');
grunt.log.writeln(dir + '\n');
var questions = [
{
type: 'confirm',
name: 'review',
message: 'Did you review all the changes with "git diff"?',
default: false
},
{
type: 'confirm',
name: 'tests',
message:
'Are you sure all tests are passing on Travis and Appveyor?',
default: false
},
{
type: 'confirm',
name: 'publish',
message:
'Are you SURE you want to publish ' +
jsonPackage.name +
'@' +
jsonPackage.version +
'?',
default: false
}
];
var done = this.async();
inquirer.prompt(questions, function(answers) {
if (
!answers.review ||
!answers.tests ||
!answers.publish
) {
grunt.log.writeln(
'Please publish bower after you fix this issue'
);
process.exit(1);
}
grunt.log.writeln(
'\nPlease remember to tag this release, and add a release with changelog on Github!'
);
grunt.log.writeln(
'\nAlso, please remember to test published Bower one more time!'
);
grunt.log.writeln(
'\nYou can promote this bower release with "npm dist-tag add bower@' + jsonPackage.version + ' latest'
);
grunt.log.writeln('\nPublishing Bower...');
childProcess.execSync('npm publish --tag beta', {
cwd: dir,
stdio: [0, 1, 2]
});
done();
});
}
);
};

View File

@@ -1,15 +1,11 @@
# Bower - A package manager for the web
[![Build](https://github.com/bower/bower/workflows/build/badge.svg)](https://github.com/bower/bower/actions?query=branch%3Amaster)
[![Backers on Open Collective](https://opencollective.com/bower/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/bower/sponsors/badge.svg)](#sponsors)
> ..psst! While Bower is maintained, we recommend [yarn](https://yarnpkg.com/) and [webpack](https://webpack.js.org/) or [parcel](https://parceljs.org/) for new front-end projects!
[![Unix CI](https://img.shields.io/travis/bower/bower/master.svg?maxAge=2592000)](https://travis-ci.org/bower/bower)
[![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)
<img align="right" height="300" src="http://bower.io/img/bower-logo.png">
---

View File

@@ -17,9 +17,9 @@ function lookup(logger, name, config) {
return !entry
? null
: {
name: name,
url: entry.url
};
name: name,
url: entry.url
};
}
);
}

View File

@@ -69,33 +69,33 @@ JsonRenderer.prototype.prompt = function(prompts) {
validator: !prompt.validate
? null
: function(value) {
var ret = prompt.validate(value);
var ret = prompt.validate(value);
if (typeof ret === 'string') {
throw ret;
}
if (typeof ret === 'string') {
throw ret;
}
return value;
}
return value;
}
};
// For now only "input", "confirm" and "password" are supported
switch (prompt.type) {
case 'input':
funcName = 'prompt';
break;
case 'confirm':
case 'password':
funcName = prompt.type;
break;
case 'checkbox':
funcName = 'prompt';
break;
default:
promise = promise.then(function() {
throw createError('Unknown prompt type', 'ENOTSUP');
});
return;
case 'input':
funcName = 'prompt';
break;
case 'confirm':
case 'password':
funcName = prompt.type;
break;
case 'checkbox':
funcName = 'prompt';
break;
default:
promise = promise.then(function() {
throw createError('Unknown prompt type', 'ENOTSUP');
});
return;
}
promise = promise.then(function() {

View File

@@ -69,39 +69,32 @@
"arr-diff": "^2.0.0",
"chai": "^3.5.0",
"coveralls": "^2.11.9",
"eslint": "^2.0.0",
"expect.js": "^0.3.1",
"grunt": "^1.0.1",
"grunt-cli": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^18.1.0",
"grunt-exec": "^0.4.7",
"grunt-simple-mocha": "^0.4.1",
"husky": "^0.14.3",
"in-publish": "^2.0.0",
"istanbul": "^0.4.3",
"lint-staged": "^7.0.0",
"load-grunt-tasks": "^3.5.0",
"lint-staged": "^9.5.0",
"mocha": "^2.5.3",
"multiline": "^1.0.2",
"nock": "^9.2.3",
"nock": "^11.7.0",
"nock-legacy": "npm:nock@9.2.3",
"node-uuid": "^1.4.7",
"prettier": "^1.11.1",
"prettier": "^1.19.1",
"proxyquire": "^1.7.9",
"spawn-sync": "1.0.15",
"wrench": "^1.5.8"
},
"scripts": {
"test": "grunt test",
"ci": "grunt travis",
"coveralls": "coveralls",
"prepublishOnly": "in-publish && echo 'You need to use \"grunt publish\" to publish bower' && false || not-in-publish",
"lint": "eslint .",
"test": "node test/packages.js && node test/packages-svn.js && mocha --timeout 15000 --reporter spec",
"prepublishOnly": "in-publish && echo 'You need to use \"node publish.js\" to publish bower' && false || not-in-publish",
"format": "prettier --write --single-quote --tab-width 4 '**/*.js'",
"precommit": "lint-staged"
},
"lint-staged": {
"*.js": [
"prettier --single-quote --tab-width 4",
"git add"
"prettier --single-quote --tab-width 4"
]
},
"files": [

View File

@@ -1,61 +0,0 @@
{
"predef": [
"console",
"describe",
"it",
"after",
"afterEach",
"before",
"beforeEach"
],
"indent": 4,
"node": true,
"devel": true,
"bitwise": false,
"curly": false,
"eqeqeq": true,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": true,
"plusplus": false,
"regexp": false,
"undef": true,
"unused": true,
"quotmark": "single",
"strict": false,
"trailing": true,
"asi": false,
"boss": true,
"debug": false,
"eqnull": true,
"es5": false,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": true,
"multistr": false,
"onecase": true,
"regexdash": false,
"scripturl": false,
"smarttabs": false,
"shadow": false,
"sub": false,
"supernew": true,
"validthis": false,
"nomen": false,
"white": true
}

View File

@@ -1,9 +0,0 @@
sudo: false
language: node_js
node_js:
- '5'
- '4'
- '0.12'
- '0.10'
script:
- grunt travis

View File

@@ -1,54 +0,0 @@
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: [
'Gruntfile.js',
'bin/*',
'lib/**/*.js',
'test/**/*.js',
'!test/assets/**/*',
'!test/reports/**/*',
'!test/tmp/**/*'
]
},
simplemocha: {
options: {
reporter: 'spec',
timeout: '10000'
},
full: {
src: ['test/test.js']
},
short: {
options: {
reporter: 'dot'
},
src: ['test/test.js']
}
},
exec: {
cover: {
command:
'STRICT_REQUIRE=1 node node_modules/istanbul/lib/cli.js cover --dir ./test/reports node_modules/mocha/bin/_mocha -- --timeout 30000 -R dot test/test.js'
},
coveralls: {
command:
'node node_modules/.bin/coveralls < test/reports/lcov.info'
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'simplemocha:short']
}
});
grunt.registerTask('test', ['jshint', 'simplemocha:full']);
grunt.registerTask('cover', 'exec:cover');
grunt.registerTask('travis', ['jshint', 'exec:cover', 'exec:coveralls']);
grunt.registerTask('default', 'test');
};

View File

@@ -1,4 +1,4 @@
# bower-config [![Build Status](https://secure.travis-ci.org/bower/config.png?branch=master)](http://travis-ci.org/bower/config)[![Coverage Status](https://coveralls.io/repos/bower/config/badge.svg?branch=master&service=github)](https://coveralls.io/github/bower/config?branch=master)
# bower-config
> The Bower config (`.bowerrc`) reader and writer.

View File

@@ -18,26 +18,16 @@
"untildify": "^2.1.0"
},
"devDependencies": {
"coveralls": "^2.11.4",
"expect.js": "^0.3.1",
"glob": "^4.5.3",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-coveralls": "^1.0.0",
"grunt-exec": "^0.4.6",
"grunt-simple-mocha": "^0.4.0",
"istanbul": "^0.4.1",
"load-grunt-tasks": "^2.0.0",
"mkdirp": "^0.5.0",
"mocha": "~1.12.0",
"mocha": "^2.5.3",
"node-uuid": "^1.4.3",
"q": "^1.2.0",
"rimraf": "^2.3.2"
},
"scripts": {
"test": "grunt test"
"test": "mocha test"
},
"files": [
"lib"

View File

@@ -177,18 +177,25 @@ describe('NPM Config on package.json', function() {
assert.equal(process.env.HTTPS_PROXY, 'http://HTTPS_PROXY');
assert.equal(process.env.NO_PROXY, 'google.com');
assert.equal(process.env.http_proxy, undefined);
assert.equal(process.env.https_proxy, undefined);
assert.equal(process.env.no_proxy, undefined);
// On windows env is case insensitive
if (process.platform === 'win32') {
assert.equal(process.env.http_proxy, 'http://HTTP_PROXY');
assert.equal(process.env.https_proxy, 'http://HTTPS_PROXY');
assert.equal(process.env.no_proxy, 'google.com');
} else {
assert.equal(process.env.http_proxy, undefined);
assert.equal(process.env.https_proxy, undefined);
assert.equal(process.env.no_proxy, undefined);
}
});
it('restores env variables', function() {
process.env.HTTP_PROXY = 'a';
process.env.HTTPS_PROXY = 'b';
process.env.NO_PROXY = 'c';
process.env.http_proxy = 'd';
process.env.https_proxy = 'e';
process.env.no_proxy = 'f';
process.env.HTTP_PROXY = 'a';
process.env.HTTPS_PROXY = 'b';
process.env.NO_PROXY = 'c';
var config = require('../lib/Config')
.create('test/assets/env-variables')
@@ -199,9 +206,16 @@ describe('NPM Config on package.json', function() {
assert.equal(process.env.HTTPS_PROXY, 'b');
assert.equal(process.env.NO_PROXY, 'c');
assert.equal(process.env.http_proxy, 'd');
assert.equal(process.env.https_proxy, 'e');
assert.equal(process.env.no_proxy, 'f');
// On windows precedence for restoring is for capital case
if (process.platform === 'win32') {
assert.equal(process.env.http_proxy, 'a');
assert.equal(process.env.https_proxy, 'b');
assert.equal(process.env.no_proxy, 'c');
} else {
assert.equal(process.env.http_proxy, 'd');
assert.equal(process.env.https_proxy, 'e');
assert.equal(process.env.no_proxy, 'f');
}
});
it('restores env variables if they are undefined', function() {
@@ -241,7 +255,7 @@ describe('Allow ${ENV} variables in .bowerrc', function() {
'test/assets/env-variables-values'
);
assert.equal('a', config.storage.packages);
assert.equal('/tmp/b', config.tmp);
assert.equal(path.resolve('/tmp/b'), config.tmp);
assert.equal('username:password', config.storage.registry.search[0]);
assert.equal('${_myshellvar}', config.scripts.postinstall);
});

View File

@@ -1,61 +0,0 @@
{
"predef": [
"console",
"describe",
"it",
"after",
"afterEach",
"before",
"beforeEach"
],
"indent": 4,
"node": true,
"devel": true,
"bitwise": false,
"curly": false,
"eqeqeq": true,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": true,
"plusplus": false,
"regexp": false,
"undef": true,
"unused": true,
"quotmark": "single",
"strict": false,
"trailing": true,
"camelcase": true,
"asi": false,
"boss": true,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": false,
"expr": true,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": true,
"multistr": false,
"onecase": true,
"regexdash": false,
"scripturl": false,
"smarttabs": false,
"shadow": false,
"sub": false,
"supernew": true,
"validthis": false,
"nomen": false,
"white": true
}

View File

@@ -1,4 +0,0 @@
language: node_js
node_js:
- "0.10"
- "0.8"

View File

@@ -1,4 +1,4 @@
# endpoint-parser [![Build Status](https://secure.travis-ci.org/bower/endpoint-parser.png?branch=master)](http://travis-ci.org/bower/endpoint-parser)
# bower-endpoint-parser
Little module that helps with endpoints parsing.

View File

@@ -16,7 +16,7 @@
},
"devDependencies": {
"expect.js": "~0.2.0",
"mocha": "~1.12.0",
"mocha": "^2.5.3",
"mout": "~0.9.0"
},
"scripts": {

View File

@@ -1,48 +0,0 @@
{
"indent": 4,
"node": true,
"devel": true,
"mocha": true,
"bitwise": false,
"curly": false,
"eqeqeq": true,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": true,
"plusplus": false,
"regexp": false,
"undef": true,
"unused": true,
"quotmark": "single",
"strict": false,
"camelcase": true,
"asi": false,
"boss": true,
"debug": false,
"eqnull": true,
"es5": false,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": true,
"multistr": false,
"onecase": true,
"regexdash": false,
"scripturl": false,
"shadow": false,
"sub": false,
"supernew": true,
"validthis": false
}

View File

@@ -1,10 +0,0 @@
sudo: false
language: node_js
node_js:
- '5'
- '4'
- '0.12'
- '0.10'
script:
- grunt travis

View File

@@ -1,57 +0,0 @@
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
jshint: {
files: [
'Gruntfile.js',
'lib/**/*.js',
'test/**/*.js',
'!test/reports/**/*'
],
options: {
jshintrc: '.jshintrc'
}
},
simplemocha: {
options: {
reporter: 'spec'
},
full: { src: ['test/test.js'] },
short: {
options: {
reporter: 'dot'
},
src: ['test/test.js']
},
build: {
options: {
reporter: 'tap'
},
src: ['test/test.js']
}
},
exec: {
cover: {
command:
'STRICT_REQUIRE=1 node node_modules/istanbul/lib/cli.js cover --dir ./test/reports node_modules/mocha/bin/_mocha -- --timeout 30000 -R dot test/test.js'
},
coveralls: {
command:
'node node_modules/.bin/coveralls < test/reports/lcov.info'
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'simplemocha:short']
}
});
// Default task.
grunt.registerTask('test', ['simplemocha:full']);
grunt.registerTask('default', ['jshint', 'test']);
grunt.registerTask('travis', ['jshint', 'exec:cover', 'exec:coveralls']);
};

View File

@@ -1,4 +1,4 @@
# bower-json [![Build Status](https://secure.travis-ci.org/bower/json.png?branch=master)](http://travis-ci.org/bower/json) [![Coverage Status](https://coveralls.io/repos/bower/json/badge.svg?branch=master&service=github)](https://coveralls.io/github/bower/json?branch=master)
# bower-json
Read `bower.json` files with semantics, normalisation, defaults and validation.

View File

@@ -16,23 +16,13 @@
"intersect": "^1.0.1"
},
"devDependencies": {
"coveralls": "^2.11.2",
"expect.js": "^0.3.1",
"grunt": "^0.4.4",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-coveralls": "^1.0.0",
"grunt-exec": "^0.4.6",
"grunt-simple-mocha": "^0.4.0",
"istanbul": "^0.3.5",
"load-grunt-tasks": "^3.3.0",
"mocha": "*",
"mocha": "^2.5.3",
"request": "^2.64.0",
"underscore.string": "^3.0.3"
},
"scripts": {
"test": "grunt test"
"test": "mocha"
},
"files": [
"lib"

View File

@@ -162,7 +162,7 @@ describe('.read', function() {
return done(err);
}
expect(file).to.equal(__dirname + '/pkg-bower-json/bower.json');
expect(file).to.equal(path.resolve(__dirname + '/pkg-bower-json/bower.json'));
done();
});
});

View File

@@ -1,62 +0,0 @@
{
"predef": [
"console",
"describe",
"it",
"after",
"afterEach",
"before",
"beforeEach"
],
"indent": 4,
"node": true,
"devel": true,
"bitwise": false,
"curly": false,
"eqeqeq": true,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": true,
"plusplus": false,
"regexp": false,
"undef": true,
"unused": true,
"quotmark": "single",
"strict": false,
"trailing": true,
"camelcase": true,
"asi": false,
"boss": true,
"debug": false,
"eqnull": true,
"es5": false,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": true,
"multistr": false,
"onecase": true,
"regexdash": false,
"scripturl": false,
"smarttabs": false,
"shadow": false,
"sub": false,
"supernew": true,
"validthis": false,
"nomen": false,
"white": true
}

View File

@@ -1,6 +0,0 @@
sudo: false
language: node_js
node_js:
- 'iojs'
- '0.12'
- '0.10'

View File

@@ -1,4 +1,4 @@
# bower-logger [![Build Status](https://secure.travis-ci.org/bower/logger.png?branch=master)](http://travis-ci.org/bower/logger)
# bower-logger
The logger used in the various architecture components of Bower.

View File

@@ -16,12 +16,12 @@
},
"devDependencies": {
"expect.js": "~0.2.0",
"mocha": "~1.12.0"
"mocha": "^2.5.3"
},
"scripts": {
"test": "mocha -R spec"
},
"files": [
"lib"
"lib"
]
}

View File

@@ -1,61 +0,0 @@
{
"predef": [
"console",
"describe",
"it",
"after",
"afterEach",
"before",
"beforeEach"
],
"indent": 4,
"node": true,
"devel": true,
"bitwise": false,
"curly": false,
"eqeqeq": true,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": true,
"plusplus": false,
"regexp": false,
"undef": true,
"unused": "vars",
"quotmark": "single",
"strict": false,
"trailing": true,
"camelcase": true,
"asi": false,
"boss": true,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": false,
"expr": true,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": true,
"multistr": false,
"onecase": true,
"regexdash": false,
"scripturl": false,
"smarttabs": false,
"shadow": false,
"sub": false,
"supernew": true,
"validthis": false,
"nomen": false,
"white": true
}

View File

@@ -1,6 +0,0 @@
sudo: false
language: node_js
node_js:
- 'iojs'
- '0.12'
- '0.10'

View File

@@ -1,42 +0,0 @@
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.initConfig({
jshint: {
files: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
simplemocha: {
options: {
reporter: 'spec',
timeout: 20000
},
full: {
src: ['test/runner.js']
},
short: {
options: {
reporter: 'dot'
},
src: ['test/runner.js']
},
build: {
options: {
reporter: 'tap'
},
src: ['test/runner.js']
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'simplemocha:short']
}
});
grunt.registerTask('test', ['simplemocha:full']);
grunt.registerTask('default', ['jshint', 'test']);
};

View File

@@ -1,4 +1,4 @@
# bower-registry-client [![Build Status](https://travis-ci.org/bower/registry-client.png?branch=master)](https://travis-ci.org/bower/registry-client)
# bower-registry-client
> Provides easy interaction with the Bower registry

View File

@@ -21,16 +21,11 @@
"devDependencies": {
"bower-config": "^1.1.2",
"expect.js": "~0.2.0",
"grunt": "~0.4.1",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-watch": "~0.5.0",
"grunt-simple-mocha": "~0.4.0",
"mocha": "~1.12.0",
"nock": "~0.22.0"
"mocha": "^2.5.3",
"nock": "9.2.3"
},
"scripts": {
"test": "grunt test"
"test": "mocha"
},
"files": [
"lib",

View File

@@ -2,9 +2,9 @@ var RegistryClient = require('../Client');
var fs = require('fs');
var expect = require('expect.js');
var md5 = require('../lib/util/md5');
var nock = require('nock');
var http = require('http');
var Config = require('bower-config');
var nock = require('nock');
describe('RegistryClient', function() {
beforeEach(function() {
@@ -213,12 +213,12 @@ describe('RegistryClient', function() {
expect(entry.url).to.eql(
'git://github.com/components/jquery.git'
);
next();
});
next();
});
});
describe('calling the lookup instance method without argument', function() {
describe.skip('calling the lookup instance method without argument', function() {
it('should return no result', function(next) {
this.timeout(10000);
this.registry.lookup('', function(err, entry) {
@@ -647,7 +647,7 @@ describe('RegistryClient', function() {
describe('calling the list instance method with two registries', function() {
beforeEach(function() {
nock('https://registry.bower.io:443')
nock('https://registry.bower.io')
.get('/packages')
.reply(200, []);
@@ -660,6 +660,9 @@ describe('RegistryClient', function() {
}
]);
this.pkg = 'jquery';
this.pkgUrl = 'git://github.com/bar/foo.git';
this.registry = new RegistryClient(
Config.read(process.cwd(), {
strictSsl: false,

View File

@@ -3,7 +3,7 @@ var expect = require('expect.js');
describe('Cache', function() {
beforeEach(function() {
this.cache = new Cache();
this.cache = new Cache(__dirname);
});
describe('Constructor', function() {

166
publish.js Normal file
View File

@@ -0,0 +1,166 @@
var tmp = require('tmp');
var fs = require('fs');
var path = require('path');
var childProcess = require('child_process');
var arraydiff = require('arr-diff');
var wrench = require('wrench');
var inquirer = require('inquirer');
var npmVersion = JSON.parse(
childProcess.execSync('npm version --json').toString()
).npm.split('.');
var npmMajor = parseInt(npmVersion[0], 10);
var npmMinor = parseInt(npmVersion[1], 10);
var jsonPackage = require('./package');
if (npmMajor !== 3 || npmMinor < 5) {
console.log('You need to use at npm@3.5 to publish bower.');
console.log(
'It is because npm 2.x produces too long paths that Windows does not handle and newer npm drops lib/node_modules'
);
console.log('Please upgrade it: npm install -g npm@3');
process.exit(1);
}
if (
childProcess
.execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.trim() !== 'master'
) {
console.log('You need to release bower from the "master" branch');
process.exit(1);
}
if (process.env.SKIP_TESTS !== '1') {
console.log('Reinstalling dependencies...');
childProcess.execSync('rm -rf node_modules && yarn', {
stdio: [0, 1, 2]
});
console.log('Running test suite...');
childProcess.execSync('yarn test', { stdio: [0, 1, 2] });
}
var dir = tmp.dirSync().name;
wrench.copyDirSyncRecursive(__dirname, dir, {
forceDelete: true,
include: function(path) {
return !path.match(/node_modules|\.git|test/);
}
});
console.log('Installing production dependencies...');
childProcess.execSync('yarn --production', {
cwd: dir,
stdio: [0, 1, 2]
});
delete jsonPackage.dependencies;
delete jsonPackage.devDependencies;
delete jsonPackage.scripts;
fs.writeFileSync(
path.resolve(dir, 'package.json'),
JSON.stringify(jsonPackage, null, ' ') + '\n'
);
console.log('Moving node_modules to lib directory...');
wrench.copyDirSyncRecursive(
path.resolve(dir, 'node_modules'),
path.resolve(dir, 'lib', 'node_modules')
);
wrench.rmdirSyncRecursive(path.resolve(dir, 'node_modules'));
console.log('Testing bower on sample project...');
childProcess.execSync(
'cd test/sample && rm -rf bower_components && ' +
dir +
'/bin/bower install --force',
{ stdio: [0, 1, 2] }
);
var expectedPackages = (
'SHA-1 ace-builds almond angular angular-animate angular-bootstrap angular-charts angular-contenteditable ' +
'angular-deckgrid angular-fullscreen angular-gravatar angular-hotkeys angular-local-storage angular-marked ' +
'angular-moment angular-sanitize angular-touch angular-ui-router angular-ui-sortable ' +
'angulartics asEvented bootstrap coffee-script d3 es6-shim font-awesome howler jquery ' +
'jquery-ui jquery-waypoints js-beautify lodash lz-string marked moment ng-file-upload peerjs ' +
'requirejs restangular slimScroll slimScrollHorizontal venturocket-angular-slider'
).split(' ');
var installedPackages = fs.readdirSync('./test/sample/bower_components');
var installedDiff = arraydiff(expectedPackages, installedPackages);
if (installedDiff.length > 0) {
console.log('ERROR. Some packages were not installed by bower: ');
console.log(installedDiff.join(', '));
process.exit(1);
}
console.log('\nBower production bundle installed in:');
console.log(dir + '\n');
var questions = [
{
type: 'confirm',
name: 'review',
message: 'Did you review all the changes with "git diff"?',
default: false
},
{
type: 'confirm',
name: 'tests',
message: 'Are you sure all tests are passing on CI?',
default: false
},
{
type: 'confirm',
name: 'publish',
message:
'Are you SURE you want to publish ' +
jsonPackage.name +
'@' +
jsonPackage.version +
'?',
default: false
}
];
var done = this.async();
inquirer.prompt(questions, function(answers) {
if (!answers.review || !answers.tests || !answers.publish) {
console.log('Please publish bower after you fix this issue');
process.exit(1);
}
console.log(
'\nPlease remember to tag this release, and add a release with changelog on Github!'
);
console.log(
'\nAlso, please remember to test published Bower one more time!'
);
console.log(
'\nYou can promote this bower release with "npm dist-tag add bower@' +
jsonPackage.version +
' latest'
);
console.log('\nPublishing Bower...');
childProcess.execSync('npm publish --tag beta', {
cwd: dir,
stdio: [0, 1, 2]
});
done();
});

View File

@@ -1,7 +1,7 @@
var expect = require('expect.js');
var path = require('path');
var helpers = require('../helpers');
var nock = require('nock');
var nock = require('../util/nock');
var rimraf = require('rimraf');
var fs = require('../../lib/util/fs');
var tar = require('tar-fs');
@@ -708,8 +708,10 @@ describe('bower install', function() {
cwd: tempDir.path
});
nock('http://dummy.local')
.get('http://github.com/yahoo/pure/archive/v0.6.0.tar.gz')
nock('http://dummy.local/')
.get(function(uri) {
return true;
})
.reply(500);
return helpers

View File

@@ -268,8 +268,7 @@ describe('PackageRepository', function() {
return Q.resolve([tempPackage, json]);
};
copy
.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
copy.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
.then(function() {
fs.writeFileSync(
path.join(tempPackage, '.bower.json'),
@@ -316,8 +315,7 @@ describe('PackageRepository', function() {
return Q.resolve([tempPackage, json]);
};
copy
.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
copy.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
.then(function() {
fs.writeFileSync(
path.join(tempPackage, '.bower.json'),
@@ -364,8 +362,7 @@ describe('PackageRepository', function() {
return Q.resolve([tempPackage, json]);
};
copy
.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
copy.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
.then(function() {
fs.writeFileSync(
path.join(tempPackage, '.bower.json'),
@@ -410,8 +407,7 @@ describe('PackageRepository', function() {
return Q.resolve([tempPackage, json]);
};
copy
.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
copy.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
.then(function() {
fs.writeFileSync(
path.join(tempPackage, '.bower.json'),

View File

@@ -88,9 +88,10 @@ describe('ResolveCache', function() {
// Create a fresh copy of the test package into temp
rimraf.sync(tempPackage);
copy
.copyDir(testPackage, tempPackage, { ignore: ['.git'] })
.then(next.bind(next, null), next);
copy.copyDir(testPackage, tempPackage, { ignore: ['.git'] }).then(
next.bind(next, null),
next
);
});
it('should move the canonical dir to source-md5/version/ folder if package meta has a version', function(next) {
@@ -158,8 +159,7 @@ describe('ResolveCache', function() {
var pkgMeta = path.join(tempPackage, '.bower.json');
// Copy bower.json to .bower.json and add some props
copy
.copyFile(path.join(tempPackage, 'component.json'), pkgMeta)
copy.copyFile(path.join(tempPackage, 'component.json'), pkgMeta)
.then(function() {
return Q.nfcall(fs.readFile, pkgMeta).then(function(
contents

View File

@@ -179,11 +179,10 @@ describe('FsResolver', function() {
mkdirp.sync(tempSource);
resolver = create(tempSource);
copy
.copyFile(
path.join(testPackage, 'foo'),
path.join(tempSource, 'foo')
)
copy.copyFile(
path.join(testPackage, 'foo'),
path.join(tempSource, 'foo')
)
.then(resolver.resolve.bind(resolver))
.then(function(dir) {
expect(fs.existsSync(path.join(dir, 'index'))).to.be(true);
@@ -202,11 +201,10 @@ describe('FsResolver', function() {
mkdirp.sync(tempSource);
resolver = create(tempSource);
copy
.copyFile(
path.join(testPackage, 'bower.json'),
path.join(tempSource, 'bower.json')
)
copy.copyFile(
path.join(testPackage, 'bower.json'),
path.join(tempSource, 'bower.json')
)
.then(resolver.resolve.bind(resolver))
.then(function(dir) {
expect(fs.existsSync(path.join(dir, 'bower.json'))).to.be(
@@ -244,8 +242,7 @@ describe('FsResolver', function() {
tempSource = path.resolve(__dirname, '../../assets/package-a-copy');
resolver = create(tempSource);
copy
.copyDir(testPackage, tempSource)
copy.copyDir(testPackage, tempSource)
.then(function() {
// Change tempSource dir to 0777
fs.chmodSync(tempSource, 0777);
@@ -269,8 +266,7 @@ describe('FsResolver', function() {
tempSource = path.resolve(__dirname, '../../tmp/temp-source');
resolver = create(tempSource);
copy
.copyFile(path.join(testPackage, 'foo'), tempSource)
copy.copyFile(path.join(testPackage, 'foo'), tempSource)
.then(function() {
// Change tempSource dir to 0777
fs.chmodSync(tempSource, 0777);

View File

@@ -146,7 +146,7 @@ describe('GitFsResolver', function() {
var dir = path.join(testPackage, 'new-dir');
fs.writeFileSync(file, 'foo');
fs.mkdir(dir);
fs.mkdirSync(dir);
function cleanup(err) {
fs.unlinkSync(file);
@@ -213,8 +213,7 @@ describe('GitFsResolver', function() {
tempSource = path.resolve(__dirname, '../../assets/package-a-copy');
resolver = create({ source: tempSource, target: 'some-branch' });
copy
.copyDir(testPackage, tempSource)
copy.copyDir(testPackage, tempSource)
.then(function() {
// Change tempSource dir to 0777
fs.chmodSync(tempSource, 0777);

View File

@@ -1,5 +1,5 @@
var path = require('path');
var nock = require('nock');
var nock = require('../../util/nock');
var fs = require('../../../lib/util/fs');
var expect = require('expect.js');
var Logger = require('bower-logger');

View File

@@ -975,14 +975,13 @@ describe('GitResolver', function() {
var dst = path.join(tempDir, '.git');
// Copy .git folder to the tempDir
copy
.copyDir(
path.resolve(__dirname, '../../assets/package-a/.git'),
dst,
copy.copyDir(
path.resolve(__dirname, '../../assets/package-a/.git'),
dst,
{
mode: 0777
}
)
)
.then(function() {
resolver._tempDir = tempDir;

View File

@@ -1,7 +1,7 @@
var expect = require('expect.js');
var path = require('path');
var fs = require('../../../lib/util/fs');
var nock = require('nock');
var nock = require('../../util/nock');
var Q = require('q');
var rimraf = require('../../../lib/util/rimraf');
var mkdirp = require('mkdirp');
@@ -530,64 +530,64 @@ describe('UrlResolver', function() {
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-zip.zip'),
{
'Content-Type': 'application/zip'
}
{
'Content-Type': 'application/zip'
}
)
.get('/package-zip2')
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-zip.zip'),
{
'Content-Type': 'application/zip; charset=UTF-8'
}
{
'Content-Type': 'application/zip; charset=UTF-8'
}
)
.get('/package-zip3')
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-zip.zip'),
{
'Content-Type': ' application/zip ; charset=UTF-8'
}
{
'Content-Type': ' application/zip ; charset=UTF-8'
}
)
.get('/package-zip4')
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-zip.zip'),
{
'Content-Type': '"application/x-zip"' // Test with quotes
}
{
'Content-Type': '"application/x-zip"' // Test with quotes
}
)
.get('/package-tar')
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-tar.tar.gz'),
{
'Content-Type': ' application/x-tgz ; charset=UTF-8'
}
{
'Content-Type': ' application/x-tgz ; charset=UTF-8'
}
)
.get('/package-tar.tar.gz')
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-tar.tar.gz'),
{
'Content-Type': ' application/x-tgz ; charset=UTF-8'
}
{
'Content-Type': ' application/x-tgz ; charset=UTF-8'
}
)
.get('/package-tar2.tar.gz')
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-tar.tar.gz'),
{
'Content-Type':
{
'Content-Type':
' application/octet-stream ; charset=UTF-8'
}
}
);
resolver = create('http://bower.io/package-zip');
@@ -698,10 +698,10 @@ describe('UrlResolver', function() {
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-zip.zip'),
{
'Content-Disposition':
{
'Content-Disposition':
'attachment; filename="package-zip.zip"'
}
}
);
resolver = create('http://bower.io/package-zip');
@@ -857,9 +857,9 @@ describe('UrlResolver', function() {
.replyWithFile(
200,
path.resolve(__dirname, '../../assets/package-zip.zip'),
{
'Content-Disposition': header
}
{
'Content-Disposition': header
}
);
resolver = create('http://bower.io/package-zip');

View File

@@ -15,13 +15,13 @@ var proxyquire = require('proxyquire')
.noPreserveCache();
var spawnSync = require('spawn-sync');
var config = require('../lib/config');
var nock = require('nock');
var nock = require('./util/nock');
var semver = require('semver');
// For better promise errors
Q.longStackSupport = true;
// Those are needed for Travis or not configured git environment
// Those are needed for testing or not configured git environment
var env = {
GIT_AUTHOR_DATE: 'Sun Apr 7 22:13:13 2013 +0000',
GIT_AUTHOR_NAME: 'André Cruz',

View File

@@ -105,9 +105,9 @@ function createRelease(dir, release, files) {
cmd('git', ['checkout', 'master', '-f'], { cwd: dir })
// Attempt to delete branch, ignoring the error
.then(function() {
return cmd('git', ['branch', '-D', branch], { cwd: dir }).fail(
function() {}
);
return cmd('git', ['branch', '-D', branch], {
cwd: dir
}).fail(function() {});
})
// Checkout based on master
.then(

View File

@@ -1,6 +1,6 @@
var expect = require('expect.js');
var helpers = require('../helpers');
var nock = require('nock');
var nock = require('../util/nock');
var path = require('path');
var Q = require('q');
@@ -13,42 +13,30 @@ describe('download', function() {
destination = tempDir.getPath('package.tar.gz');
function downloadTest(opts) {
var deferred = Q.defer();
tempDir.prepare();
opts.response(nock('http://bower.io', opts.nockOpts));
download(
return download(
opts.sourceUrl || 'http://bower.io/package.tar.gz',
opts.destinationPath || destination,
opts.downloadOpts
)
.then(
function(result) {
if (opts.expect) {
opts.expect(result);
deferred.resolve();
} else {
deferred.reject(
new Error(
'Error expected. Got successful response.'
)
);
}
},
function(error) {
if (opts.expectError) {
opts.expectError(error);
deferred.resolve();
} else {
deferred.reject(error);
}
).then(
function(result) {
if (opts.expect) {
opts.expect(result);
} else {
throw new Error('Error expected. Got successful response.');
}
)
.done();
return deferred.promise;
},
function(error) {
if (opts.expectError) {
opts.expectError(error);
} else {
throw error;
}
}
);
}
it('download file to directory', function() {
@@ -112,8 +100,7 @@ describe('download', function() {
return downloadTest({
response: function(nock) {
// First connection + 5 retries
nock
.get('/package.tar.gz')
nock.get('/package.tar.gz')
.times(6)
.delayConnection(1000)
.replyWithFile(200, source);
@@ -134,8 +121,7 @@ describe('download', function() {
return downloadTest({
response: function(nock) {
// First connection + 5 retries
nock
.get('/package.tar.gz')
nock.get('/package.tar.gz')
.times(6)
.socketDelay(1000)
.replyWithFile(200, source);
@@ -156,8 +142,7 @@ describe('download', function() {
return downloadTest({
response: function(nock) {
// First connection + 5 retries
nock
.get('/package.tar.gz')
nock.get('/package.tar.gz')
.times(5)
.delayConnection(1000)
.replyWithFile(200, source);
@@ -180,9 +165,9 @@ describe('download', function() {
return downloadTest({
response: function(nock) {
// First connection + 5 retries
nock
.get('/package.tar.gz')
.replyWithFile(200, source, { 'Content-Length': 5000 });
nock.get('/package.tar.gz').replyWithFile(200, source, {
'Content-Length': 5000
});
},
expectError: function(e) {
expect(e.code).to.be('EINCOMPLETE');
@@ -208,11 +193,13 @@ describe('download', function() {
return downloadTest({
response: function(nock) {
nock
.get('/' + sourceFilename)
.replyWithFile(200, sourceFile, {
nock.get('/' + sourceFilename).replyWithFile(
200,
sourceFile,
{
'Content-Encoding': 'gzip'
});
}
);
},
expect: function() {
expect(fs.readFileSync(destinationPath, 'ascii')).to.be(

4
test/util/nock.js Normal file
View File

@@ -0,0 +1,4 @@
var NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
module.exports =
NODE_MAJOR_VERSION >= 12 ? require('nock') : require('nock-legacy');

3091
yarn.lock

File diff suppressed because it is too large Load Diff