Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Count files in vinyl streams. Log pretty messages.
This plugin solves a similar problem to gulp-debug but is designed as an actual permanent part of your workflow, not just a debug tool (though it still makes a great debug tool!). As such, it provides more control over logging to customize as needed.
First, install gulp-count
as a development dependency:
> npm install --save-dev gulp-count
Then, add it to your gulpfile.js
:
var count = require('gulp-count');
gulp.task('copy', function() {
gulp.src('assets/**.*')
.pipe(gulp.dest('build'))
.pipe(count('## assets copied'));
});
gulp-count can be called with a string message template, an options object, or both.
gulp.src('*.html')
.pipe(count()) // logs "36 files"
.pipe(count('<%= counter %> HTML files')) // logs "36 HTML files"
.pipe(count('found ## pages', {logFiles: true})) // logs each path and "found 36 pages"
.pipe(count({
message: '<%= files %>? That\'s ## too many!'
logger: (msg) -> alert(msg) // alerts "36 files? That's 36 too many!"
});
count(options?)
count(message, options?)
options.message: boolean | string = "<%= files %>"
Template string for total count message, passed through gutil.template
.
Template can use two variables:
counter
- the number of files encountered in this stream,files
- a correctly pluralized string of the format "X file[s]" where X is counter
.The template also expands the shorthand "##"
to "<%= counter %>"
.
An explicit false
value will disable the message (use logFiles
or logEmpty
instead).
options.logFiles: boolean | string = false
Whether to log each file path as it is encountered. options.cwd
determines base path for logging.
If a string is provided then it is used as the message template. Template receives two variables:
file
- the current Vinyl file instancepath
- file path resolved relative to options.cwd
and colored yellow.options.logEmpty: boolean | string = false
Whether to log the message when the stream is empty.
If a string is provided then it is used as the message template and receives the same variables as options.message
.
Setting { message: false, logEmpty: true }
will log if and only if the stream is empty.
options.title: string
String prepended to every message to distinguish the output of multiple instances logging at once. A falsy value will print nothing.
options.cwd: string = ""
Current working directory against which file paths are resolved in template strings.
options.logger: (message) => any = gutil.log
Logger function, called with each formatted message. Defaults to gulp-util's log(msg...)
function.
MIT © Palantir Technologies
FAQs
count files in vinyl streams
The npm package gulp-count receives a total of 2,642 weekly downloads. As such, gulp-count popularity was classified as popular.
We found that gulp-count demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.