Skip to content

Commit

Permalink
Update dependencies and lodash ver 4
Browse files Browse the repository at this point in the history
  • Loading branch information
pgilad committed Apr 5, 2016
1 parent e9d10e1 commit 7fc2bed
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
"updates"
],
"dependencies": {
"async-each-series": "^1.0.0",
"findup-sync": "^0.2.1",
"inquirer": "^0.9.0",
"lodash": "^3.9.1",
"npm-package-arg": "^4.0.1",
"semver": "^5.0.1"
"async-each-series": "^1.1.0",
"findup-sync": "^0.4.0",
"inquirer": "^0.12.0",
"lodash": "^4.8.2",
"npm-package-arg": "^4.1.0",
"semver": "^5.1.0"
},
"devDependencies": {
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-nodeunit": "^0.4.1",
"jshint-stylish": "^2.0.1",
"load-grunt-tasks": "^3.2.0"
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-nodeunit": "^1.0.0",
"jshint-stylish": "^2.1.0",
"load-grunt-tasks": "^3.4.1"
},
"peerDependencies": {
"grunt": ">=0.4.0"
Expand Down
4 changes: 2 additions & 2 deletions tasks/dev_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Licensed under the MIT license.
*/

var _ = require('lodash');
var includes = require('lodash/includes');
var path = require('path');

module.exports = function (grunt) {
Expand All @@ -32,7 +32,7 @@ module.exports = function (grunt) {

//validate updateType option
var updateType = options.updateType;
if (!_.includes(possibleUpdateTypes, updateType)) {
if (!includes(possibleUpdateTypes, updateType)) {
grunt.warn('updateType ' + String(updateType).cyan + ' not supported.');
//if force
options.updateType = 'report';
Expand Down
29 changes: 17 additions & 12 deletions tasks/lib/dev_update.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
/*
* grunt-dev-update
*
* Copyright (c) 2014 Gilad Peleg
* Copyright (c) 2016 Gilad Peleg
* Licensed under the MIT license.
*/

var asyncEach = require('async-each-series');
var semver = require('semver');
var _ = require('lodash');
var filter = require('lodash/filter');
var find = require('lodash/find');
var findup = require('findup-sync');
var forEach = require('lodash/forEach');
var includes = require('lodash/includes');
var keys = require('lodash/keys');
var map = require('lodash/map');
var npa = require('npm-package-arg');
var semver = require('semver');

//default spawn options
var spawnOptions = {
Expand All @@ -19,7 +24,7 @@ var spawnOptions = {
};

var shouldOnlyReport = function (reportOnlyPkgs, pkgName) {
return reportOnlyPkgs.length && _.includes(reportOnlyPkgs, pkgName);
return reportOnlyPkgs.length && includes(reportOnlyPkgs, pkgName);
};

/**
Expand Down Expand Up @@ -89,14 +94,14 @@ module.exports = function (grunt) {
var getPackageNames = function (packages) {
var pkg = getPackageJson(getPkgJsonPath());
var mappedPkgs = [];
_.forEach(packages, function (dep) {
forEach(packages, function (dep) {
//get packages by type from package.json
dep.deps = pkg[dep.type];
grunt.log.writeln('Found ' + _.keys(dep.deps).length + ' ' + dep.type.blue + ' to check for latest version');
_.forEach(dep.deps, function (item, key) {
grunt.log.writeln('Found ' + keys(dep.deps).length + ' ' + dep.type.blue + ' to check for latest version');
forEach(dep.deps, function (item, key) {
var parsed = npa(key + '@' + item);
grunt.verbose.writelns('Parsed package:', key, parsed);
if (!_.includes(['version', 'tag', 'range'], parsed.type)) {
if (!includes(['version', 'tag', 'range'], parsed.type)) {
grunt.verbose.writelns(key.red + ' - doesn\'t seem local to npm. Skipping...');
return null;
}
Expand All @@ -111,7 +116,7 @@ module.exports = function (grunt) {
};

var getOutdatedPkgs = function (packages, done) {
var pkgNames = _.pluck(packages, 'name');
var pkgNames = map(packages, 'name');
spawnOptions.args = getSpawnArguments('outdated').concat(pkgNames);
spawnOptions.opts = {};
grunt.util.spawn(spawnOptions, function (error, result) {
Expand Down Expand Up @@ -201,7 +206,7 @@ module.exports = function (grunt) {
exports.options = options;

//get only the kind of packages user wants
var packageTypes = _.filter([devDeps, prodDeps], function (pkgType) {
var packageTypes = filter([devDeps, prodDeps], function (pkgType) {
return options.packages[pkgType.type];
});

Expand All @@ -221,8 +226,8 @@ module.exports = function (grunt) {
grunt.log.oklns('All packages are up to date');
return done();
}
asyncEach(_.keys(result), function (pkgName, cb) {
var pkg = _.findWhere(packages, {
asyncEach(keys(result), function (pkgName, cb) {
var pkg = find(packages, {
name: pkgName
});
var specs = result[pkgName];
Expand Down

0 comments on commit 7fc2bed

Please sign in to comment.