grunt-plugin-pkg2cmp

To create a component.json file for bower from the package.json

npm install grunt-plugin-pkg2cmp
5 downloads in the last month

grunt-plugin-pkg2cmp

To create a component.json file for bower from the package.json

Getting Started

This plugin requires Grunt ~0.4.1

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-plugin-pkg2cmp --save-dev

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

grunt.loadNpmTasks('grunt-plugin-pkg2cmp');

The "plugin_pkg2cmp" task

Overview

In your project's Gruntfile, add a section named plugin_pkg2cmp to the data object passed into grunt.initConfig().

grunt.initConfig({
  pkg2cmp: {
    options: {
      // overwrite 'main' or 'dependencies' in the package.json here.
    },
    target: {}
  }
})

Options

options.main

Type array or string. Such as ['main.js']

options.dependencies

Type: object. Such as {'jquery': '1.9.2'}

Usage Examples

Default Options

In this example, all of 'name', 'version', 'main' and 'dependencies' will be got from the package.json.

grunt.initConfig({
  pkg2cmp: {
    target: {}
  },
})

Custom Options

In this example, both 'name' and 'version' will be got from the package.json, 'main' will be overwrite to 'main.min.js', 'dependencies' will be added an additional key-value pair in the component.json.

grunt.initConfig({
  plugin_pkg2cmp: {
    options: {
      main: 'main.min.js',
      dependencies: {
        'backbone': '1.0.0'
      }
    },
    target: {}
  }
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1.0 Init version. Copy 'name', 'version', 'main' and 'dependencies' in the package.json to the componenet.json, add allow overwrite 'main' and update 'denpendencies' in the 'options' field.

npm loves you