Skip to content

Commit 1577ef7

Browse files
committed
Test on Node 5, drop Node 0.10, update deps, bump version to 0.12.0-pre
1 parent 121a66f commit 1577ef7

File tree

9 files changed

+41
-52
lines changed

9 files changed

+41
-52
lines changed

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// Rules are divided into sections from http://eslint.org/docs/rules/
1212

1313
// ECMAScript 6
14-
"prefer-spread": 0, // TODO enable in Node 5 or 6
1514
"prefer-reflect": 0 // TODO enable when Node supports it
1615
}
1716
}

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
language: node_js
22
sudo: false
33
node_js:
4-
- '0.10'
54
- '0.12'
65
- '4'
6+
- '5'
77
before_install:
88
# Prevent Bower from asking questions.
99
- export CI=true
1010
# Log HTTP requests
1111
- npm config set loglevel http
12-
# Update npm on Node 0.10; default is too old
13-
- if [ "`node --version | cut -f1-2 -d.`" == "v0.10" ]; then npm -g install npm; fi
1412
install:
1513
- time npm install

Gruntfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// Disable options that don't work in Node.js 0.10.
3+
// Disable options that don't work in Node.js 0.12.
44
// Gruntfile.js & tasks/*.js are the only non-transpiled files.
55
/* eslint-disable no-var, object-shorthand, prefer-arrow-callback, prefer-const,
66
prefer-spread, prefer-reflect, prefer-template */
@@ -9,7 +9,7 @@ var assert = require('assert');
99

1010
var newNode;
1111
try {
12-
assert.strictEqual(eval('(() => 2)()'), 2); // eslint-disable-line no-eval
12+
assert.strictEqual(eval('(r => [...r])([2])[0]'), 2); // eslint-disable-line no-eval
1313
newNode = true;
1414
} catch (e) {
1515
newNode = false;
@@ -67,7 +67,7 @@ module.exports = function (grunt) {
6767
// 'es6.parameters',
6868
'es6.properties.computed',
6969
'es6.properties.shorthand',
70-
// 'es6.spread',
70+
'es6.spread',
7171
// 'es6.tailCall',
7272
'es6.templateLiterals',
7373
// 'es6.regex.unicode',

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ require('check-dependencies')({}, callback);
214214
behave in the same way - `callback` is invoked upon completion; if there was an error, it's passed as a parameter to `callback`.
215215

216216
## Supported Node.js versions
217-
This project aims to support all Node.js LTS versions in the "active" phase (see [LTS README](https://github.com/nodejs/LTS/blob/master/README.md) for more details) as well as the latest stable Node.js. Today that means Node.js 0.12 & 4.x.
218-
219-
Because of the popularity of this package and Node.js 0.10, this version is temporarily supported as well.
217+
This project aims to support all Node.js LTS versions in the "active" phase (see [LTS README](https://github.com/nodejs/LTS/blob/master/README.md) for more details) as well as the latest stable Node.js. Today that means Node.js 0.12, 4 & 5.
220218

221219
## Contributing
222220
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using `npm test`.

bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict';
44

5-
// Disable options that don't work in Node.js 0.10.
5+
// Disable options that don't work in Node.js 0.12.
66
// Gruntfile.js & tasks/*.js are the only non-transpiled files.
77
/* eslint-disable no-var */
88

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

3-
// Disable options that don't work in Node.js 0.10.
3+
// Disable options that don't work in Node.js 0.12.
44
// Gruntfile.js & tasks/*.js are the only non-transpiled files.
55
/* eslint-disable no-var, no-eval */
66

77
var assert = require('assert');
88

99
try {
10-
assert.strictEqual(eval('(() => 2)()'), 2);
10+
assert.strictEqual(eval('(r => [...r])([2])[0]'), 2);
1111
module.exports = require('./lib/check-dependencies');
1212
} catch (e) {
1313
module.exports = require('./dist/lib/check-dependencies');

lib/check-dependencies.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const chalk = require('chalk');
88
const findup = require('findup-sync');
99
const _ = require('lodash');
1010
const semver = require('semver');
11-
const Promise = require('bluebird'); // TODO remove when Node.js 0.10 is dropped
1211
const spawn = require('child_process').spawn;
1312
const spawnSync = require('child_process').spawnSync;
1413

@@ -29,15 +28,15 @@ const checkDependenciesHelper = (syncOrAsync, config, callback) => {
2928
config = null;
3029
}
3130
if (typeof callback !== 'function') {
32-
if (callback != null) {
31+
if (callback == null) {
32+
// In the async mode we return the promise anyway; assign callback
33+
// to noop to keep code consistency.
34+
callback = _.noop;
35+
} else {
3336
// If callback was simply not provided, we assume the user wanted
3437
// to handle the returned promise. If it was passed but not a function
3538
// we assume user error and throw.
3639
throw new Error('The provided callback wasn\'t a function! Got:', callback);
37-
} else {
38-
// In the async mode we return the promise anyway; assign callback
39-
// to noop to keep code consistency.
40-
callback = _.noop;
4140
}
4241
}
4342
}
@@ -187,12 +186,12 @@ const checkDependenciesHelper = (syncOrAsync, config, callback) => {
187186
}
188187

189188
depVersion = require(depJson).version;
190-
if (!semver.satisfies(depVersion, versionString)) {
191-
success = false;
192-
error(`${ name }: installed: ${ chalk.red(depVersion)
189+
if (semver.satisfies(depVersion, versionString)) {
190+
log(`${ name }: installed: ${ chalk.green(depVersion)
193191
}, expected: ${ chalk.green(versionString) }`);
194192
} else {
195-
log(`${ name }: installed: ${ chalk.green(depVersion)
193+
success = false;
194+
error(`${ name }: installed: ${ chalk.red(depVersion)
196195
}, expected: ${ chalk.green(versionString) }`);
197196
}
198197
};
@@ -314,11 +313,6 @@ const checkDependenciesHelper = (syncOrAsync, config, callback) => {
314313
const installMissing = () => installOrPrune('install');
315314
const pruneExcessive = () => installOrPrune('prune');
316315

317-
if (syncOrAsync !== 'sync') {
318-
// TODO disable it in a more clever way?
319-
Promise.onPossiblyUnhandledRejection();
320-
}
321-
322316
if (syncOrAsync === 'sync') {
323317
try {
324318
if (installNeeded) {
@@ -359,7 +353,7 @@ const checkDependenciesHelper = (syncOrAsync, config, callback) => {
359353
module.exports = function checkDependencies(/* config, callback */) {
360354
const args = Array.prototype.slice.call(arguments);
361355
args.unshift('async');
362-
return checkDependenciesHelper.apply(null, args);
356+
return checkDependenciesHelper(...args);
363357
};
364358

365359
module.exports.sync = function checkDependenciesSync(/* config */) {
@@ -372,5 +366,5 @@ module.exports.sync = function checkDependenciesSync(/* config */) {
372366
}
373367
const args = Array.prototype.slice.call(arguments);
374368
args.unshift('sync');
375-
return checkDependenciesHelper.apply(null, args);
369+
return checkDependenciesHelper(...args);
376370
};

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "check-dependencies",
3-
"version": "0.11.1-pre",
3+
"version": "0.12.0-pre",
44
"description": "Checks if currently installed npm/bower dependencies are installed in the exact same versions that are specified in package.json/bower.json",
55
"homepage": "https://github.com/mzgol/check-dependencies",
66
"author": {
@@ -31,29 +31,29 @@
3131
"dist/lib"
3232
],
3333
"dependencies": {
34-
"bluebird": "^2.10.0",
35-
"bower-config": "^0.6.1",
34+
"bower-config": "^1.2.2",
3635
"chalk": "^1.1.1",
3736
"findup-sync": "^0.3.0",
3837
"lodash": "^3.10.1",
3938
"minimist": "^1.2.0",
4039
"semver": "^5.0.3"
4140
},
4241
"devDependencies": {
43-
"bower": "1.5.2",
44-
"eslint-config-mzgol": "0.0.3",
45-
"fs-extra": "0.24.0",
42+
"bluebird": "3.0.2",
43+
"bower": "1.6.5",
44+
"eslint-config-mzgol": "0.0.6",
45+
"fs-extra": "0.26.0",
4646
"grunt": "0.4.5",
47-
"grunt-babel": "5.0.1",
47+
"grunt-babel": "5.0.3",
4848
"grunt-cli": "0.1.13",
4949
"grunt-contrib-clean": "0.6.0",
50-
"grunt-contrib-copy": "0.8.1",
51-
"grunt-eslint": "17.1.0",
50+
"grunt-contrib-copy": "0.8.2",
51+
"grunt-eslint": "17.3.1",
5252
"grunt-mocha-test": "0.12.7",
53-
"load-grunt-tasks": "3.2.0",
54-
"mocha": "2.3.2",
55-
"sinon": "1.16.1",
56-
"time-grunt": "1.2.1"
53+
"load-grunt-tasks": "3.3.0",
54+
"mocha": "2.3.3",
55+
"sinon": "1.17.2",
56+
"time-grunt": "1.2.2"
5757
},
5858
"scripts": {
5959
"test": "grunt"

test/spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ describe('checkDependencies', () => {
3434
}
3535

3636
if (checkDependenciesMode === 'callbacks') {
37-
checkDependencies.apply(null, args);
37+
checkDependencies(...args);
3838
}
3939
if (checkDependenciesMode === 'promises') {
4040
callback = args.pop();
41-
checkDependencies.apply(null, args)
41+
checkDependencies(...args)
4242
.then(output => {
4343
callback(output);
4444
})
@@ -49,7 +49,7 @@ describe('checkDependencies', () => {
4949
}
5050
if (checkDependenciesMode === 'sync') {
5151
callback = args.pop();
52-
callback(checkDependencies.sync.apply(null, args));
52+
callback(checkDependencies.sync(...args));
5353
}
5454
};
5555
};
@@ -418,7 +418,9 @@ describe('checkDependencies', () => {
418418
it('should check custom package name dependencies only if `checkCustomPackageNames` ' +
419419
'is true and we are testing bower, not npm', done => {
420420

421-
if (packageManager !== 'npm') {
421+
if (packageManager === 'npm') {
422+
done();
423+
} else {
422424

423425
checkDeps({
424426
checkCustomPackageNames: true,
@@ -443,14 +445,14 @@ describe('checkDependencies', () => {
443445
done();
444446
});
445447

446-
} else {
447-
done();
448448
}
449449
});
450450

451451
it('should find no errors if checkCustomPackageNames=true and custom package names are ok',
452452
done => {
453-
if (packageManager !== 'npm') {
453+
if (packageManager === 'npm') {
454+
done();
455+
} else {
454456
checkDeps({
455457
checkCustomPackageNames: true,
456458
packageDir: `${ __dirname }/bower-fixtures/custom-package-ok`,
@@ -462,8 +464,6 @@ describe('checkDependencies', () => {
462464
done();
463465
});
464466

465-
} else {
466-
done();
467467
}
468468
});
469469

0 commit comments

Comments
 (0)