-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Add "task not completed" warnings
- Loading branch information
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
var log = require('gulplog'); | ||
var chalk = require('chalk'); | ||
|
||
var tasks = {}; | ||
|
||
function warn() { | ||
var taskKeys = Object.keys(tasks); | ||
|
||
if (!taskKeys.length) { | ||
return; | ||
} | ||
|
||
var taskNames = taskKeys.map(function(key) { | ||
return tasks[key]; | ||
}).join(', '); | ||
|
||
log.warn( | ||
chalk.red('The following tasks did not complete:'), | ||
chalk.cyan(taskNames) | ||
); | ||
log.warn( | ||
chalk.red('Did you forget to signal async completion?') | ||
); | ||
} | ||
|
||
function start(e) { | ||
tasks[e.uid] = e.name; | ||
} | ||
|
||
function clear(e) { | ||
delete tasks[e.uid]; | ||
} | ||
|
||
function logSyncTask(gulpInst) { | ||
|
||
process.once('exit', warn); | ||
gulpInst.on('start', start); | ||
gulpInst.on('stop', clear); | ||
gulpInst.on('error', clear); | ||
} | ||
|
||
module.exports = logSyncTask; |