Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

grunt-dry

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-dry

grunt scaffolding for reusable modules

latest
Source
npmnpm
Version
0.3.1
Version published
Weekly downloads
7
250%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-dry: reusable grunt task configuration for modules

This is a simple package that pulls in a lot of boilerplate grunt logic for a reusable javascript module.

Getting Started

Install grunt and grunt-dry using NPM:

npm install --save-dev grunt grunt-dry

Then create a gruntfile.js containing:

module.exports = function(grunt) {
    grunt.initConfig({
        gruntDry: {
            pkg: grunt.file.readJSON('package.json');
        }
    });

    grunt.task.loadNpmTasks('grunt-dry');
});

Then run the following grunt tasks:

grunt build

Uses grunt-pure-cjs to generate browser/<module_name>.js and browser/specs/*.spec.js by bundling the commonjs files into a single file for both the module itself and any mocha spec files.

Each file is generated using a umd wrapper so it can be loaded through a variety of front-end module systems.

grunt test

Runs unit tests using server-side mocha in node.js from specs/*.js and in browser using `browser/specs/*.js.

All tests are loaded using requirejs.

Managing Dependencies

If the module and/or the tests requires external dependencies, they should be included in the deps option of the grunt config. Each entry should contain a path to the browser build of the module as well as an optional flag to indicate if it is test-only.

For example the following configuration would indicate that the library depends on underscore and the tests also depend on chai:

deps: {
    'underscore': {
        browserBuild: 'node_modules/underscore/underscore.js'
    },
    'chai': {
        browserBuild: 'node_modules/chai/chai.js',
        testOnly: true
    }
}

See grunt-dry-test/gruntfile.js for a complete working example.

Options

The configuration supports the following options:

  • pkg: (required) package.json contents
  • root: Specifies the location of the grunt-dry task. The default is node_modules/grunt-dry.
  • sourceMap: If true, then the package will generate a source map when building the browser bundle.

Keywords

grunt

FAQs

Package last updated on 24 Mar 2016

Did you know?

Socket

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.

Install

Related posts