mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08:00
Add grunt.log.warn method
This commit is contained in:
@@ -73,3 +73,46 @@ exports = (grunt: IGrunt) => {
|
||||
fileMaps[0].src.length;
|
||||
fileMaps[0].dest;
|
||||
};
|
||||
|
||||
// Official grunt task template from
|
||||
// https://github.com/gruntjs/grunt-init-gruntplugin/blob/master/root/tasks/name.js
|
||||
exports.exports = function(grunt: IGrunt) {
|
||||
|
||||
// Please see the Grunt documentation for more information regarding task
|
||||
// creation: http://gruntjs.com/creating-tasks
|
||||
|
||||
grunt.registerMultiTask('taskName', 'task description', function() {
|
||||
// Merge task-specific and/or target-specific options with these defaults.
|
||||
var options = this.options({
|
||||
punctuation: '.',
|
||||
separator: ', '
|
||||
});
|
||||
|
||||
// Iterate over all specified file groups.
|
||||
this.files.forEach(function(f) {
|
||||
// Concat specified files.
|
||||
var src = f.src.filter(function(filepath) {
|
||||
// Warn on and remove invalid source files (if nonull was set).
|
||||
if (!grunt.file.exists(filepath)) {
|
||||
grunt.log.warn('Source file "' + filepath + '" not found.');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}).map(function(filepath) {
|
||||
// Read file source.
|
||||
return grunt.file.read(filepath);
|
||||
}).join(grunt.util.normalizelf(options.separator));
|
||||
|
||||
// Handle options.
|
||||
src += options.punctuation;
|
||||
|
||||
// Write the destination file.
|
||||
grunt.file.write(f.dest, src);
|
||||
|
||||
// Print a success message.
|
||||
grunt.log.writeln('File "' + f.dest + '" created.');
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
Vendored
+5
@@ -690,6 +690,11 @@ declare module grunt {
|
||||
* Log a list of obj properties (good for debugging flags).
|
||||
*/
|
||||
writeflags(obj: any): T
|
||||
|
||||
/**
|
||||
* Log an warning with grunt.log.warn
|
||||
*/
|
||||
warn(msg: string): T
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user