Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
});
});
Expand All @@ -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;
}

Expand All @@ -85,7 +85,7 @@ program
});
})
.catch(function(err) {
gutil.log(gutil.colors.red.bold(err));
console.log(chalk.red.bold(err));
process.exit(1);
});
});
Expand All @@ -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);
});
});
Expand All @@ -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);
});
});
Expand All @@ -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);
});
});
Expand Down
10 changes: 5 additions & 5 deletions lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
}

Expand Down Expand Up @@ -72,7 +72,7 @@ module.exports = function(config) {
}
}

gutil.log('Deploying "' + commitMessage + '"');
console.log('Deploying "' + commitMessage + '"');

if (cloneDir) {
ghPagesConfig.clone = cloneDir;
Expand All @@ -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) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/integrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var spinnerMessage;

function startSpinner(message) {
spinnerMessage = message;
cli.spinner(message);
cli.spinner(' ' + message);
}

function stopSpinner(error) {
Expand Down
18 changes: 13 additions & 5 deletions lib/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ 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');

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
Expand Down Expand Up @@ -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.'));
}
});
});
Expand All @@ -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.');
}
});
Expand All @@ -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 || [/./],
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down