Minimalist Grunt plugin to sync only basic properties between package.json and bower.json


Minimalist Grunt plugin to keep package.json and bower.json synchronized

By default, this plugin syncs the following properties from package.json to bower.json:

  • name
  • version
  • main

Note that if a bower.json file does not exist, the plugin creates on first. There is no option to turn this off, since there is no reason to use the plugin if you aren't syncing with anything :-).

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-sync-pkg --save-dev

Once that's done, add this line to your project's Gruntfile:


If the plugin has been installed correctly, you should now be able to run grunt sync at the command line to run the sync task.

Type: Array Default: ['name', 'version', 'main']

Properties to sync from package.json to bower.json.

Type: Array Default: undefined

Properties to exclude from syncing.

Type: Obj Default: undefined

Specify an additional JSON file to sync, such as myplugin.jquery.json.

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.

Jon Schlinkert

Copyright (c) 2013 Jon Schlinkert Released under the MIT License.