From 12f6381e8085ea78aeb6912c2500ddec4dc2c91e Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 11 Nov 2015 11:36:05 +0000 Subject: [PATCH 1/4] Add two spaces before the integrate spinner message --- lib/integrate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/integrate.js b/lib/integrate.js index 5b394c18..c0c9f495 100644 --- a/lib/integrate.js +++ b/lib/integrate.js @@ -26,7 +26,7 @@ var spinnerMessage; function startSpinner(message) { spinnerMessage = message; - cli.spinner(message); + cli.spinner(' ' + message); } function stopSpinner(error) { From 0293995707bede58e1daca09fbf11a684617e4e8 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 11 Nov 2015 12:17:40 +0000 Subject: [PATCH 2/4] Use chalk in place of gutil.colors. Fixes #167 --- cli.js | 13 +++++++------ lib/deploy.js | 5 +++-- lib/offline.js | 7 ++++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cli.js b/cli.js index b2a366bb..bcc56696 100755 --- a/cli.js +++ b/cli.js @@ -27,6 +27,7 @@ var rimraf = promisify(require('rimraf')); var promptly = require('promisified-promptly'); var fs = require('fs'); var gutil = require('gulp-util'); +var chalk = require('chalk'); // The scripts that implement the various commands/tasks we expose. var configure = require('./lib/configure'); @@ -46,7 +47,7 @@ program .then(function() { process.exit(0); }, function(err) { - gutil.log(gutil.colors.red.bold(err)); + gutil.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -68,7 +69,7 @@ program fs.access('.gitignore', function(err) { if (err) { - gutil.log(gutil.colors.blue.bold('.gh-pages-cache is a temporary repository that we use to push changes to your gh-pages branch. We suggest you add it to your .gitignore.')); + gutil.log(chalk.blue.bold('.gh-pages-cache is a temporary repository that we use to push changes to your gh-pages branch. We suggest you add it to your .gitignore.')); return; } @@ -85,7 +86,7 @@ program }); }) .catch(function(err) { - gutil.log(gutil.colors.red.bold(err)); + gutil.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -102,7 +103,7 @@ program importScripts: options.importScripts ? options.importScripts.split(',') : null, }) .catch(function(err) { - gutil.log(gutil.colors.red.bold(err)); + gutil.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -117,7 +118,7 @@ program .then(function() { process.exit(0); }, function(err) { - gutil.log(gutil.colors.red.bold(err)); + gutil.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -130,7 +131,7 @@ program dir: dir, }) .catch(function(err) { - gutil.log(gutil.colors.red.bold(err)); + gutil.log(chalk.red.bold(err)); process.exit(1); }); }); diff --git a/lib/deploy.js b/lib/deploy.js index ddee4b8a..75640613 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -23,6 +23,7 @@ var childProcess = require('child_process'); var ghPages = require('gh-pages'); var gitconfiglocal = require('gitconfiglocal'); var gutil = require('gulp-util'); +var chalk = require('chalk'); var fs = require('fs'); var fse = require('fs-extra'); var path = require('path'); @@ -34,7 +35,7 @@ function getCommitMessage() { var errorText = spawn.stderr.toString().trim(); if (errorText) { - gutil.log(gutil.colors.red.bold('Fatal error from `git log`. You must have one commit before deploying.')); + gutil.log(chalk.red.bold('Fatal error from `git log`. You must have one commit before deploying.')); throw new Error(errorText); } @@ -82,7 +83,7 @@ module.exports = function(config) { fs.stat(path.join(rootDir, 'node_modules'), function(err, stat) { if (!err && stat.isDirectory()) { - gutil.log(gutil.colors.yellow.bold('With the current value of the \'rootDir\' option, the entire node_modules directory is going to be deployed. Please make sure this is what you really want.')); + gutil.log(chalk.yellow.bold('With the current value of the \'rootDir\' option, the entire node_modules directory is going to be deployed. Please make sure this is what you really want.')); } gitconfiglocal('./', function(error, config) { diff --git a/lib/offline.js b/lib/offline.js index 630a549b..35483599 100644 --- a/lib/offline.js +++ b/lib/offline.js @@ -23,6 +23,7 @@ var fs = require('fs'); var path = require('path'); var swPrecache = promisify(require('sw-precache')); var gutil = require('gulp-util'); +var chalk = require('chalk'); var ghslug = promisify(require('github-slug')); var glob = require('glob'); @@ -70,7 +71,7 @@ module.exports = function(config) { var stat = fs.statSync(file); if (stat.isFile() && stat.size > 2 * 1024 * 1024 && staticFileGlobs.indexOf(file) === -1) { - gutil.log(gutil.colors.yellow.bold(file + ' is bigger than 2 MiB. Are you sure you want to cache it? To suppress this warning, explicitly include the file in the fileGlobs list.')); + gutil.log(chalk.yellow.bold(file + ' is bigger than 2 MiB. Are you sure you want to cache it? To suppress this warning, explicitly include the file in the fileGlobs list.')); } }); }); @@ -81,12 +82,12 @@ module.exports = function(config) { try { stat = fs.statSync(path.join(rootDir, script)); } catch (ex) { - gutil.log(gutil.colors.red.bold(script + ' doesn\'t exist.')); + gutil.log(chalk.red.bold(script + ' doesn\'t exist.')); throw ex; } if (!stat.isFile()) { - gutil.log(gutil.colors.red.bold(script + ' is not a file.')); + gutil.log(chalk.red.bold(script + ' is not a file.')); throw new Error(script + ' is not a file.'); } }); From 7fa3e501826447c2f038ed5f214e1da66582a47f Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 11 Nov 2015 12:20:01 +0000 Subject: [PATCH 3/4] Directly use console.log instead of gutil.log --- cli.js | 13 ++++++------- lib/deploy.js | 9 ++++----- lib/offline.js | 9 ++++----- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/cli.js b/cli.js index bcc56696..25a8fa6c 100755 --- a/cli.js +++ b/cli.js @@ -26,7 +26,6 @@ var program = require('commander'); var rimraf = promisify(require('rimraf')); var promptly = require('promisified-promptly'); var fs = require('fs'); -var gutil = require('gulp-util'); var chalk = require('chalk'); // The scripts that implement the various commands/tasks we expose. @@ -47,7 +46,7 @@ program .then(function() { process.exit(0); }, function(err) { - gutil.log(chalk.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -69,7 +68,7 @@ program fs.access('.gitignore', function(err) { if (err) { - gutil.log(chalk.blue.bold('.gh-pages-cache is a temporary repository that we use to push changes to your gh-pages branch. We suggest you add it to your .gitignore.')); + console.log(chalk.blue.bold('.gh-pages-cache is a temporary repository that we use to push changes to your gh-pages branch. We suggest you add it to your .gitignore.')); return; } @@ -86,7 +85,7 @@ program }); }) .catch(function(err) { - gutil.log(chalk.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -103,7 +102,7 @@ program importScripts: options.importScripts ? options.importScripts.split(',') : null, }) .catch(function(err) { - gutil.log(chalk.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -118,7 +117,7 @@ program .then(function() { process.exit(0); }, function(err) { - gutil.log(chalk.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -131,7 +130,7 @@ program dir: dir, }) .catch(function(err) { - gutil.log(chalk.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); diff --git a/lib/deploy.js b/lib/deploy.js index 75640613..575fdd2f 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -22,7 +22,6 @@ var promisify = require('promisify-node'); var childProcess = require('child_process'); var ghPages = require('gh-pages'); var gitconfiglocal = require('gitconfiglocal'); -var gutil = require('gulp-util'); var chalk = require('chalk'); var fs = require('fs'); var fse = require('fs-extra'); @@ -35,7 +34,7 @@ function getCommitMessage() { var errorText = spawn.stderr.toString().trim(); if (errorText) { - gutil.log(chalk.red.bold('Fatal error from `git log`. You must have one commit before deploying.')); + console.log(chalk.red.bold('Fatal error from `git log`. You must have one commit before deploying.')); throw new Error(errorText); } @@ -73,7 +72,7 @@ module.exports = function(config) { } } - gutil.log('Deploying "' + commitMessage + '"'); + console.log('Deploying "' + commitMessage + '"'); if (cloneDir) { ghPagesConfig.clone = cloneDir; @@ -83,7 +82,7 @@ module.exports = function(config) { fs.stat(path.join(rootDir, 'node_modules'), function(err, stat) { if (!err && stat.isDirectory()) { - gutil.log(chalk.yellow.bold('With the current value of the \'rootDir\' option, the entire node_modules directory is going to be deployed. Please make sure this is what you really want.')); + console.log(chalk.yellow.bold('With the current value of the \'rootDir\' option, the entire node_modules directory is going to be deployed. Please make sure this is what you really want.')); } gitconfiglocal('./', function(error, config) { @@ -95,7 +94,7 @@ module.exports = function(config) { // We can't log on Travis because it would leak the GitHub token. // We can't use the gh-pages silent option because it makes error messages // less informative (https://github.com/mozilla/oghliner/pull/58#issuecomment-147550610). - ghPagesConfig.logger = ('GH_TOKEN' in process.env) ? function() {} : gutil.log; + ghPagesConfig.logger = ('GH_TOKEN' in process.env) ? function() {} : console.log; if ('GH_TOKEN' in process.env) { // We're using a token to authenticate with GitHub, so we have to embed diff --git a/lib/offline.js b/lib/offline.js index 35483599..c2719014 100644 --- a/lib/offline.js +++ b/lib/offline.js @@ -22,7 +22,6 @@ var promisify = require('promisify-node'); var fs = require('fs'); var path = require('path'); var swPrecache = promisify(require('sw-precache')); -var gutil = require('gulp-util'); var chalk = require('chalk'); var ghslug = promisify(require('github-slug')); var glob = require('glob'); @@ -71,7 +70,7 @@ module.exports = function(config) { var stat = fs.statSync(file); if (stat.isFile() && stat.size > 2 * 1024 * 1024 && staticFileGlobs.indexOf(file) === -1) { - gutil.log(chalk.yellow.bold(file + ' is bigger than 2 MiB. Are you sure you want to cache it? To suppress this warning, explicitly include the file in the fileGlobs list.')); + console.log(chalk.yellow.bold(file + ' is bigger than 2 MiB. Are you sure you want to cache it? To suppress this warning, explicitly include the file in the fileGlobs list.')); } }); }); @@ -82,12 +81,12 @@ module.exports = function(config) { try { stat = fs.statSync(path.join(rootDir, script)); } catch (ex) { - gutil.log(chalk.red.bold(script + ' doesn\'t exist.')); + console.log(chalk.red.bold(script + ' doesn\'t exist.')); throw ex; } if (!stat.isFile()) { - gutil.log(chalk.red.bold(script + ' is not a file.')); + console.log(chalk.red.bold(script + ' is not a file.')); throw new Error(script + ' is not a file.'); } }); @@ -96,7 +95,7 @@ module.exports = function(config) { staticFileGlobs: staticFileGlobs, stripPrefix: rootDir, verbose: true, - logger: gutil.log, + logger: console.log, importScripts: importScripts, cacheId: cacheId, ignoreUrlParametersMatching: config.ignoreUrlParametersMatching || [/./], From c365bcb4f7238041329288528231097a523da336 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 11 Nov 2015 12:22:35 +0000 Subject: [PATCH 4/4] Remove gulp-util dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 6e72206f..4b4cd708 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "gulp-install": "https://github.com/marco-c/gulp-install/tarball/56f8ebf87f14651f586d6377dea75c2f3d1b1691", "gulp-rename": "^1.2.2", "gulp-template": "^3.0.0", - "gulp-util": "^3.0.6", "mozilla-tabzilla": "^0.5.1", "promisified-promptly": "^1.0.0", "promisify-node": "^0.2.1",