mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Compare commits
25 Commits
ext-name
...
travis-mod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
febf300fdd | ||
|
|
0eab022654 | ||
|
|
c190c74df9 | ||
|
|
6137633412 | ||
|
|
c2cb4f7c48 | ||
|
|
225dc0b69f | ||
|
|
e0825d1f47 | ||
|
|
b4ecfa5a96 | ||
|
|
3321382c62 | ||
|
|
e4a4cd1ba0 | ||
|
|
7901011d34 | ||
|
|
f313129e85 | ||
|
|
fb5a798920 | ||
|
|
6104718892 | ||
|
|
021736f7c5 | ||
|
|
66bd9d1fc4 | ||
|
|
07d40e7fbf | ||
|
|
16b651139a | ||
|
|
b47ce33e9e | ||
|
|
4996448d68 | ||
|
|
da1baa055f | ||
|
|
3e294789b5 | ||
|
|
45408e9589 | ||
|
|
cbb9b4415e | ||
|
|
e3328a4034 |
@@ -1,47 +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: "10"
|
||||
- nodejs_version: "12"
|
||||
|
||||
# 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
6
.eslintignore
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
test/assets
|
||||
test/reports
|
||||
test/sample
|
||||
test/tmp
|
||||
packages/bower-logger/test
|
||||
@@ -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
62
.github/workflows/nodejs.yml
vendored
Normal 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
|
||||
@@ -1,2 +1,4 @@
|
||||
**/node_modules/**
|
||||
**/test/assets/**
|
||||
**/bower_components/**
|
||||
test/sample
|
||||
|
||||
44
.travis.yml
44
.travis.yml
@@ -1,44 +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="10"
|
||||
- TEST_NODE_VERSION="12"
|
||||
|
||||
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
|
||||
250
Gruntfile.js
250
Gruntfile.js
@@ -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();
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -1,15 +1,11 @@
|
||||
# Bower - A package manager for the web
|
||||
|
||||
[](https://github.com/bower/bower/actions?query=branch%3Amaster)
|
||||
[](#backers)
|
||||
[](#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!
|
||||
|
||||
[](https://travis-ci.org/bower/bower)
|
||||
[](https://ci.appveyor.com/project/bower/bower)
|
||||
[](https://coveralls.io/r/bower/bower?branch=master)
|
||||
[](https://discord.gg/0fFM7QF0KpZRh2cY)
|
||||
|
||||
<img align="right" height="300" src="http://bower.io/img/bower-logo.png">
|
||||
|
||||
---
|
||||
|
||||
@@ -17,9 +17,9 @@ function lookup(logger, name, config) {
|
||||
return !entry
|
||||
? null
|
||||
: {
|
||||
name: name,
|
||||
url: entry.url
|
||||
};
|
||||
name: name,
|
||||
url: entry.url
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
19
package.json
19
package.json
@@ -69,33 +69,26 @@
|
||||
"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": "^9.5.0",
|
||||
"load-grunt-tasks": "^3.5.0",
|
||||
"mocha": "^2.5.3",
|
||||
"multiline": "^1.0.2",
|
||||
"nock-legacy": "npm: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"
|
||||
},
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- '5'
|
||||
- '4'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
script:
|
||||
- grunt travis
|
||||
@@ -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');
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
# bower-config [](http://travis-ci.org/bower/config)[](https://coveralls.io/github/bower/config?branch=master)
|
||||
# bower-config
|
||||
|
||||
> The Bower config (`.bowerrc`) reader and writer.
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
@@ -1,4 +1,4 @@
|
||||
# endpoint-parser [](http://travis-ci.org/bower/endpoint-parser)
|
||||
# bower-endpoint-parser
|
||||
|
||||
Little module that helps with endpoints parsing.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"expect.js": "~0.2.0",
|
||||
"mocha": "~1.12.0",
|
||||
"mocha": "^2.5.3",
|
||||
"mout": "~0.9.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- '5'
|
||||
- '4'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
|
||||
script:
|
||||
- grunt travis
|
||||
@@ -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']);
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
# bower-json [](http://travis-ci.org/bower/json) [](https://coveralls.io/github/bower/json?branch=master)
|
||||
# bower-json
|
||||
|
||||
Read `bower.json` files with semantics, normalisation, defaults and validation.
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- 'iojs'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
@@ -1,4 +1,4 @@
|
||||
# bower-logger [](http://travis-ci.org/bower/logger)
|
||||
# bower-logger
|
||||
|
||||
The logger used in the various architecture components of Bower.
|
||||
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- 'iojs'
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
@@ -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']);
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
# bower-registry-client [](https://travis-ci.org/bower/registry-client)
|
||||
# bower-registry-client
|
||||
|
||||
> Provides easy interaction with the Bower registry
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
166
publish.js
Normal 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();
|
||||
});
|
||||
@@ -709,7 +709,9 @@ describe('bower install', function() {
|
||||
});
|
||||
|
||||
nock('http://dummy.local/')
|
||||
.get(function(uri) { return true; })
|
||||
.get(function(uri) {
|
||||
return true;
|
||||
})
|
||||
.reply(500);
|
||||
|
||||
return helpers
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -21,7 +21,7 @@ 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',
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -21,25 +21,22 @@ describe('download', function() {
|
||||
opts.sourceUrl || 'http://bower.io/package.tar.gz',
|
||||
opts.destinationPath || destination,
|
||||
opts.downloadOpts
|
||||
)
|
||||
.then(
|
||||
function(result) {
|
||||
if (opts.expect) {
|
||||
opts.expect(result);
|
||||
} else {
|
||||
throw new Error(
|
||||
'Error expected. Got successful response.'
|
||||
);
|
||||
}
|
||||
},
|
||||
function(error) {
|
||||
if (opts.expectError) {
|
||||
opts.expectError(error);
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
).then(
|
||||
function(result) {
|
||||
if (opts.expect) {
|
||||
opts.expect(result);
|
||||
} else {
|
||||
throw new Error('Error expected. Got successful response.');
|
||||
}
|
||||
)
|
||||
},
|
||||
function(error) {
|
||||
if (opts.expectError) {
|
||||
opts.expectError(error);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
it('download file to directory', function() {
|
||||
@@ -103,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);
|
||||
@@ -125,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);
|
||||
@@ -147,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);
|
||||
@@ -171,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');
|
||||
@@ -199,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(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
var NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
|
||||
|
||||
module.exports = NODE_MAJOR_VERSION >= 12 ? require('nock') : require('nock-legacy')
|
||||
module.exports =
|
||||
NODE_MAJOR_VERSION >= 12 ? require('nock') : require('nock-legacy');
|
||||
|
||||
Reference in New Issue
Block a user