npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-npm-run

v0.0.3

Published

npm scripts become gulp tasks

Downloads

868

Readme

gulp-npm-run

Creates gulp tasks for your npm scripts. Notifies if a task fails, using node-notifier via childish-process. Notifications can be customized.

Use

NPM

As simple as it gets:

var gulp = require('gulp-npm-run')(require('gulp'));

Configure

It can take configuration options, here are a few of them:

var gulp = require('gulp-npm-run')(require('gulp'), {
  exclude: ['test'], // the test script is excluded
  include: {'necessary': 'a must-have task, because...'} // just a helpful description
  require: ['necessary'], // maybe because other tasks depend it
  requireStrict: false,
  npmRun: false // rather than `npm run script` gulp runs the script's value / command(s)
});

By require we insist there must be corresponding scripts in package.json - it's a declaration of assumptions or dependencies to insist on being satisfied. Use requireStrict: true to make sure require is actually satisfied - gulp will not run any tasks until all the scripts are found, with this option. There will be a warning in either case. Require is a separate concern with regards to exclude, a script can be both required and excluded -- i.e. if it's expected in package.json without corresponding task created, for whatever reason.

The test script / task is good to exclude in favor of gulp-npm-test, which does the same, only better. Or, perhaps because you'd like to implement your very own test task. In any case, excluding scripts isn't strictly required to gulp-implement them, as one can simply call gulp.task to replace any pre-existing task code. Anyway, there may be npm scripts for which you do not want to have gulp tasks. Exclude enables that.

Include / Help

The counterpart of exclude is include, which could be an Array whitelist. Its more useful form is an Object, the keys corresponding to npm scripts, the values as help for gulp-help. In accordance with its gulp.task api this help can be a message String, or false in which case the script's gulp task doesn't show with gulp help. All tasks created by gulp-npm-run will have help messages by default - these basically show what the script (i.e. command) being npm run is, exactly. Use the new task api to describe tasks subsequently added, if more complete documentation is desired.

gulp help

However, please note that in order to enable help, you'd either have to either:

  1. use beverage for this and other reasons,
  2. or setup gulp-help on your own:
var gulp = require('gulp-npm-run')(require('gulp-help')(require('gulp')));

Help is entirely optional, gulp-npm-run does not modify gulp's api for you.

Further

See datomiki for a practical, somewhat more advanced usage example.

See childish-process for further understanding of templates, default and customize - options for configuring a task's event-handlers / notifications.

Tests Build Status

install.sh #once
npm test

Though gulp-npm-run should work on any platform, its tests may need a *nix to run, e.g. Linux, MacOS, etc.

Develop

Dependency Status devDependency Status

License

MIT