gulp-print
Advanced tools
Comparing version 4.0.2 to 5.0.0
@@ -5,23 +5,24 @@ "use strict"; | ||
const path = require("path"); | ||
const log = require("fancy-log"); | ||
const fancyLog = require("fancy-log"); | ||
const colors = require("ansi-colors"); | ||
const result = (() => { | ||
const gulpPrint = function (format) { | ||
if (format == null) { | ||
format = (filepath) => filepath; | ||
let log = fancyLog; | ||
function setLogFunction(fn) { | ||
log = fn; | ||
} | ||
exports.setLogFunction = setLogFunction; | ||
function gulpPrint(format) { | ||
if (!format) { | ||
format = (filepath) => filepath; | ||
} | ||
function mapFile(file, cb) { | ||
const filepath = colors.magenta(path.relative(process.cwd(), file.path)); | ||
const formatted = format(filepath); | ||
if (formatted) { | ||
log(formatted); | ||
} | ||
function mapFile(file, cb) { | ||
const filepath = colors.magenta(path.relative(process.cwd(), file.path)); | ||
const formatted = format(filepath); | ||
if (formatted) { | ||
gulpPrint.log(formatted); | ||
} | ||
cb(null, file); | ||
} | ||
return map(mapFile); | ||
}; | ||
gulpPrint.log = log; | ||
return gulpPrint; | ||
})(); | ||
exports.default = result; | ||
cb(null, file); | ||
} | ||
return map(mapFile); | ||
} | ||
exports.default = gulpPrint; | ||
//# sourceMappingURL=gulp-print.js.map |
{ | ||
"name": "gulp-print", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"description": "Prints names of files to the console so that you can see what's going through the the gulp pipe.", | ||
@@ -34,3 +34,3 @@ "files": [ | ||
"tsc": "tsc -p src/tsconfig.json", | ||
"prepublish": "npm run eslint && npm test && npm run tsc" | ||
"prepublish": "npm run eslint && npm test" | ||
}, | ||
@@ -37,0 +37,0 @@ "dependencies": { |
@@ -39,2 +39,7 @@ # gulp-print | ||
}); | ||
// ... change log function | ||
import { setLogFunction } from 'gulp-print'; | ||
setLogFunction(message => console.log('LOG', message)); | ||
``` | ||
@@ -41,0 +46,0 @@ |
6799
26
81