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

load-common-gulp-tasks

v1.1.0

Published

Load common gulp tasks and configs so you don't need to redefine them for every module

Downloads

33

Readme

load-common-gulp-tasks NPM version Build Status

Load common gulp tasks and configs so you don't need to redefine them for every module

Supplies a common interface to the following gulp modules:

  1. gulp-mocha
  2. gulp-jshint
  3. gulp-istanbul
  4. gulp-istanbul-enforcer
  5. gulp-plato
  6. gulp-help
  7. gulp-nice-package
  8. gulp-shrinkwrap

Available Tasks

gulp help for available tasks. Right now these are the default tasks:

Debug Tests

You can debug your mocha tests using a tool like node-inspector combined with the gulp test-debug target

Basic Usage

// gulpfile.js
var gulp = require('load-common-gulp-tasks')(require('gulp'));

Options

load-common-gulp-tasks tries to assume smart defaults but also attempts to be very configurable. Each option can be overridden by passing an options object as the second parameter, e.g. require('load-common-gulp-tasks')(gulp, options);

options.istanbul

Type: Object

Default:

{
  includeUntested: true
}

See here for all available options

options.istanbulWriteReports

Type: Object

Default:

{
  dir: './target/coverage'
}

See here for all available options

options.istanbulEnforcer

Type: Object

Default:

{
  thresholds: {
    statements: 80,
    branches: 70,
    lines: 80,
    functions: 80
  },
  coverageDirectory: './target/coverage',
  rootDirectory: ''
}

See here for all available options

options.paths

Type: Object

Default:

{
  lint: [
    './*.js',
    './lib/**/*.js',
    './test/**/*.js'
  ],
  felint: [
    './content/**/*.js'
  ],
  cover: [
    './lib/**/*.js'
  ],
  test: [
    './test/**/*.js'
  ]
}

Glob paths used by the associated targets

options.jshintrc.server

Type: String

Default: node_modules/load-common-gulp-tasks/lint/.jshintrc

.jshintrc file to use when running gulp lint target

options.jshintrc.client

Type: String

Default: node_modules/load-common-gulp-tasks/felint/.jshintrc

.jshintrc file to use when running gulp felint target

options.complexity.destDir

Type: String

Default: ./target/complexity

Report destination.

options.complexity.options

Type: Object

Default: {}

Options passed to complexity-report.

options.showStreamSize

Type: Boolean

Default: false

Optionally show the gulp stream size of each task

options.nicePackage.spec

Type: String

Default: npm

spec option for package.json-validator

options.nicePackage.options

Type: Object

Default:

{
    warnings: false,
    recommendations: false
}

spec option for package.json-validator

options.mocha

Type: Object

Default:

{
    timeout: 2000,
    reporter: 'dot'
}

These options are passed to gulp-mocha in testing tasks.

If a timeout option is given, it will also be used as a default value for options.mochaWatch, used in 'watching' test tasks.

See here for all available options

options.mochaWatch

Type: Object

Default:

{
    timeout: 2000,  // overriden by options.mocha.timeout if present
    reporter: 'min',
    growl: true
}

If a timeout option is not given here, but in options.mocha, it will be used here. These options are passed to gulp-mocha when used in 'watching' tests.

See here for all available options Note: some options, like growl, remain undocumented.

Advanced Usage

To override default tasks or create new ones, simply define them after calling require('load-common-gulp-tasks')(gulp); in your gulpfile.js, e.g.

var gulp = require('gulp'),
  sass = require('gulp-sass'),
  sassFiles = './lib/*/sass/*.scss',
  options;

// ------------------------
// custom coverage settings
// ------------------------
options = {
  istanbulEnforcer: {
    thresholds: {
      statements: 83, // higher than default
      branches: 59, // lower than default
      // lines not defined. use default
      functions: 58
    }
  }
};

// ------------------------
// load common tasks
// ------------------------
require('load-common-gulp-tasks')(gulp, options);

// ------------------------
// custom tasks
// ------------------------
gulp.task('watch', 'Watch sass files and recompile on change', function () {
  gulp.watch(sassFiles, ['styles']);
});

gulp.task('styles', 'Compile sass to css', function () {
  return gulp.src(sassFiles)
    .pipe(sass())
    .pipe(gulp.dest('./public'));
});

License

MIT © Chris Montgomery