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

beverage

v0.0.8

Published

give it a gulp

Downloads

83

Readme

beverage -- give it a gulp

version npm dependencies js-standard-style

The DRYest gulp for the thirsty.

Why

Because even with: gulp-npm-run, gulp-npm-test, gulp-cause, sourcegate, and hal-rc - I'd still do a lot of copy-pasting between gulpfiles.

What

There is almost always test + test:watch, and often some kind of build + build:watch tasks, and some linter / hinter config, that could be common / similar across projects, as well as a dev task that runs the above and perhaps some other tasks in parallel...

All of the above are optional, but there would be no use of beverage if none of the projects listed are enabled, or configured.

Beverage is all about improving your gulp experience with little to no effort.

Ecosystem The Ready Column

Here is a diagram of dependencies / modules that beverage makes more convenient to use.

Use

NPM

All that's needed in a gulpfile.js, besides gulp, for starters, is:

var gulp = require('beverage')(require('gulp'), {
  // options listed next
})
// use gulp as you would otherise

Or, even simpler, if beverage fulfills all your gulp task needs, you could load options from a .beverage file with just the following line in gulpfile.js to set gulp up:

var gulp = require(‘beverage’)(require(‘gulp’))

Or the absolute simplest gulpfile.js:

var gulp = require(‘beverage’)()

Beverage will use your local gulp and you must have it installed, something that gulp itself insists on. Otherwise you will be reminded. The options in this last example come from .beverage but you could also provide you own as a first argument.

Configure

It will not do anything unless given some options:

  • dotBeverage: [] contains the relative paths where beverage will look for .beverage configuration files - the default is [‘node_modules/beverage/node_modules/hal-rc’, ’.’] - this is the only option one would have to override via gulpfile.js
  • causality: [] add declarative tasks via gulp-cause
  • harp: {} web server and browser-sync via gulp-harp
  • test: {} will setup gulp test provided there is a npm test script, see gulp-npm-test for configuration options
  • scripts: {} makes gulp tasks for all your package.json scripts, see gulp-npm-run for optional configuration, the test script / task is better with gulp-npm-test which is automatically favored
  • sourcegate & sourceopt, the latter is optional, both handled by hal-rc, where they are documented

CLI

There is also a beverage-cli, that can be installed separately.

Help

To see what tasks beverage has created:

gulp help
# or gulp
# or beve
# or beverage

Help is the default gulp task. Create a ’default’ task to change that.

Here is an example output:

Usage
  gulp [task]

Available tasks
  beverage          The recipe of this beverage.
  build             sourcegates.js
  build:watch       sourcegates.coffee
  dev               DEVELOP
  help              Display this help text.
  sourcegate        Write sourcegate targets.
  sourcegate:watch  Watch sourcegate sources for changes.
  test              A gulp-npm-test task, using `mocha`.
  test:watch        sourcegates.js,test/*.coffee

For which, I only had to add a dev task:

gulp.task('dev', 'DEVELOP', ['build', 'build:watch', 'test:watch'])

Credits to gulp-help.

See the current beverage configuration options with beverage -o or gulp beverage.

Hope this helps.

Defaults & Overrides

Beverage options are deep-merged in the following order of sources:

  1. index.js - look at the def function (it has a few defaults)
  2. ./node_modules/beverage/node_modules/hal-rc/.beverage - where I keep hal-rc defaults, in the future there could be more defaults between steps 2 and 3...
  3. ./.beverage - your project options via a configuration file
  4. gulpfile.js - your project options via javascript code

Steps 2 and 3 can be changed with a dotBeverage option given through gulpfile.js. It’s an array of paths where .beverage is to be looked for. For example, if you had a package called special-recipe that had all your default configuration, here is a gulpfile.js starting point:

var gulp = require(‘beverage’)(require(‘gulp’), {
  dotBeverage: [‘node_modules/special-recipe’, ’.’]
})

One could of-course write a module that wraps beverage, whether to change default options or add functionality that my beverage won’t include:

var merge = require('lodash.merge')
module.exports = function (gulpIn, options) {
  var gulp = require('beverage')(gulpIn, merge({
      // your special beverage options
    },
    options
  ))
// do more with gulp…
return gulp
}

Test Build Status

npm test

Depvelop Dependency Status devDependency Status

js-standard-style

Unlicensed

This is free and unencumbered public domain software. For more information, see UNLICENSE.