grunt-npm-command

    0.1.2 • Public • Published

    grunt-npm-command Version Build Status Dependency Status

    Run npm commands (like install or update) from Grunt.

    Getting Started

    This plugin requires Grunt ~0.4.0

    If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

    npm install grunt-npm-command --save-dev

    Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

    grunt.loadNpmTasks('grunt-npm-command');

    This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade, but in case you can't please use v0.3.2.

    Command task

    Run this task with the grunt npm-command command.

    Task targets, files and options may be specified according to the grunt Configuring tasks guide.

    Options

    options.cmd

    Type: String Default: 'install'

    Defines the npm command to run.

    options.args

    Type: String Default: []

    Defines the npm arguments to pass to the command.

    options.cwd

    Type: String Default: ''

    Defines the working directory to run npm <cmd> <args>. By default it will be run in the current directory.

    options.failOnError

    Type: Boolean Default: true

    Fail the build if an error occurs while running the npm command.

    Usage

    To run npm install on a subdirectory:

    'npm-command': {
      foobar: {
        options: {
          cwd: 'foobar/'
        }
      }
    }

    To run npm update --production on multiple subdirectories:

    'npm-command': {
      options: {
        cmd: 'update',
        args: ['--production']
      },
     
      foobar: {
        options: {
          cwd: 'foobar/'
        }
      },
     
      bazqux: {
        options: {
          cwd: 'bazqux/'
        }
      }
    }

    Meta

    Contributors

    License

    Copyright (c) 2015 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.

    Install

    npm i grunt-npm-command

    DownloadsWeekly Downloads

    3,005

    Version

    0.1.2

    License

    MIT

    Last publish

    Collaborators

    • unindented