diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c711fc..c789c62 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+# [1.1.0](https://github.com/slushjs/gulp-install/compare/v1.0.1...v1.1.0) (2017-03-23)
+
+
+### Features
+
+* add callback support (closes [#17](https://github.com/slushjs/gulp-install/issues/17) [#31](https://github.com/slushjs/gulp-install/issues/31)) ([2e58f84](https://github.com/slushjs/gulp-install/commit/2e58f84))
+
+
+
## [1.0.1](https://github.com/slushjs/gulp-install/compare/v1.0.0...v1.0.1) (2017-03-23)
diff --git a/index.js b/index.js
index ded69ce..415a1a8 100644
--- a/index.js
+++ b/index.js
@@ -2,10 +2,12 @@
const path = require('path');
const through2 = require('through2');
const dargs = require('dargs');
-const gutil = require('gulp-util');
+const logger = require('fancy-log');
+const chalk = require('chalk');
const groupBy = require('lodash.groupby');
const PQueue = require('p-queue');
const commandRunner = require('./lib/command-runner');
+const fs = require('fs');
const commands = {
tsd: ['reinstall', '--save'],
@@ -45,6 +47,30 @@ module.exports = function (opts = {}, done = noop) {
if (!file.path) {
return cb();
}
+
+ if (opts.compare) {
+ var cdir = path.join(__dirname, '/compares/', path.dirname(file.path));
+ var cfile = path.join(cdir, path.basename(file.path));
+ try {
+ require(cfile);
+ } catch (e) {
+ if (!fs.existsSync(cdir)) {
+ cdir.split(path.sep).reduce((curPath, folder) => {
+ curPath += folder + path.sep;
+ if (!fs.existsSync(curPath)) fs.mkdirSync(curPath);
+ return curPath;
+ }, '');
+ };
+ if (e.code === 'MODULE_NOT_FOUND') fs.writeFileSync(cfile, JSON.stringify({}));
+ }
+ let moduleJSON = JSON.stringify(require(file.path), null, ' ');
+ if (JSON.stringify(require(cfile), null, ' ') !== moduleJSON) {
+ fs.writeFileSync(cfile, moduleJSON);
+ } else {
+ return cb();
+ }
+ }
+
if (fileToCommand[path.basename(file.path)]) {
const cmd = {
cmd: fileToCommand[path.basename(file.path)],
@@ -85,7 +111,7 @@ module.exports = function (opts = {}, done = noop) {
return cb();
}
if (skipInstall()) {
- log('Skipping install.', 'Run `' + gutil.colors.yellow(formatCommands(toRun)) + '` manually');
+ log('Skipping install.', 'Run `' + chalk.yellow(formatCommands(toRun)) + '` manually');
return cb();
}
const groupedCommands = groupBy(toRun, 'cmd');
@@ -103,7 +129,7 @@ module.exports = function (opts = {}, done = noop) {
function logFailure(command) {
return promise => {
return promise.catch(err => {
- log(err.message, ', run `' + gutil.colors.yellow(formatCommand(command)) + '` manually');
+ log(err.message, ', run `' + chalk.yellow(formatCommand(command)) + '` manually');
throw err;
});
};
@@ -113,7 +139,7 @@ function log(...args) {
if (isTest()) {
return;
}
- gutil.log(...args);
+ logger(...args);
}
function formatCommands(cmds) {
diff --git a/package.json b/package.json
index df3c447..4629cf8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gulp-install",
- "version": "1.0.1",
+ "version": "1.1.0",
"description": "Automatically install npm, bower, tsd, and pip packages/dependencies if the relative configurations are found in the gulp file stream respectively",
"main": "index.js",
"scripts": {
@@ -23,8 +23,10 @@
},
"homepage": "https://github.com/slushjs/gulp-install",
"dependencies": {
+ "chalk": "^2.3.0",
+ "fancy-log": "^1.3.2",
+ "vinyl": "^2.1.0",
"dargs": "^5.1.0",
- "gulp-util": "^3.0.7",
"lodash.groupby": "^4.6.0",
"p-queue": "^1.0.0",
"through2": "^2.0.3",
diff --git a/test/install-test.js b/test/install-test.js
index e35bf78..99cde5a 100644
--- a/test/install-test.js
+++ b/test/install-test.js
@@ -3,7 +3,7 @@
'use strict';
const path = require('path');
const chai = require('chai');
-const gutil = require('gulp-util');
+const vinyl = require('vinyl');
const commandRunner = require('../lib/command-runner');
const install = require('../.');
@@ -12,7 +12,7 @@ const args = process.argv.slice();
function fixture(file) {
const filepath = path.join(__dirname, file);
- return new gutil.File({
+ return new vinyl({
path: filepath,
cwd: __dirname,
base: path.join(__dirname, path.dirname(file)),