diff --git a/cli.js b/cli.js index b2a366bb..25a8fa6c 100755 --- a/cli.js +++ b/cli.js @@ -26,7 +26,7 @@ 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. var configure = require('./lib/configure'); @@ -46,7 +46,7 @@ program .then(function() { process.exit(0); }, function(err) { - gutil.log(gutil.colors.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -68,7 +68,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.')); + 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; } @@ -85,7 +85,7 @@ program }); }) .catch(function(err) { - gutil.log(gutil.colors.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -102,7 +102,7 @@ program importScripts: options.importScripts ? options.importScripts.split(',') : null, }) .catch(function(err) { - gutil.log(gutil.colors.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -117,7 +117,7 @@ program .then(function() { process.exit(0); }, function(err) { - gutil.log(gutil.colors.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); @@ -130,7 +130,7 @@ program dir: dir, }) .catch(function(err) { - gutil.log(gutil.colors.red.bold(err)); + console.log(chalk.red.bold(err)); process.exit(1); }); }); diff --git a/lib/deploy.js b/lib/deploy.js index ddee4b8a..575fdd2f 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -22,7 +22,7 @@ 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'); var path = require('path'); @@ -34,7 +34,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.')); + console.log(chalk.red.bold('Fatal error from `git log`. You must have one commit before deploying.')); throw new Error(errorText); } @@ -72,7 +72,7 @@ module.exports = function(config) { } } - gutil.log('Deploying "' + commitMessage + '"'); + console.log('Deploying "' + commitMessage + '"'); if (cloneDir) { ghPagesConfig.clone = cloneDir; @@ -82,7 +82,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.')); + 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) { @@ -94,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/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) { diff --git a/lib/offline.js b/lib/offline.js index 630a549b..1d63b08a 100644 --- a/lib/offline.js +++ b/lib/offline.js @@ -22,7 +22,7 @@ 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'); @@ -30,6 +30,8 @@ module.exports = function(config) { return new Promise(function(resolve, reject) { var rootDir = config.rootDir || './'; + console.log('Offlining ' + chalk.bold(rootDir) + ' to ' + chalk.bold(path.join(rootDir, 'offline-worker.js')) + '…\n'); + // Ensure root directory ends with slash so we strip leading slash from paths // of files to cache, so they're relative paths, and the offline worker // will match them regardless of whether the app is deployed to a top-level @@ -70,7 +72,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.')); + 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.')); } }); }); @@ -81,12 +83,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.')); + console.log(chalk.red.bold(script + ' doesn\'t exist.')); throw ex; } if (!stat.isFile()) { - gutil.log(gutil.colors.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.'); } }); @@ -95,7 +97,13 @@ module.exports = function(config) { staticFileGlobs: staticFileGlobs, stripPrefix: rootDir, verbose: true, - logger: gutil.log, + logger: function(message) { + if (message.indexOf('Caching') === 0) { + message = chalk.bold.green('✓ ') + message.replace('static resource ', '') + } + + console.log(message); + }, importScripts: importScripts, cacheId: cacheId, ignoreUrlParametersMatching: config.ignoreUrlParametersMatching || [/./], 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",