Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 18689d3abfa2d64b6573a46b8f39d488d638d0c6 @jonschlinkert jonschlinkert committed Sep 9, 2013
Showing with 202 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +39 −0 Gruntfile.js
  3. +22 −0 LICENSE-MIT
  4. +56 −0 README.md
  5. +37 −0 package.json
  6. +40 −0 tasks/sync.js
@@ -0,0 +1,8 @@
+node_modules
+npm-debug.log
+
+tmp
+temp
+TODO.md
+
+*.sublime-*
@@ -0,0 +1,39 @@
+/*
+ * grunt-sync-pkg
+ * https://github.com/jps/grunt-sync-pkg
+ *
+ * Copyright (c) 2013 Jon Schlinkert
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function (grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ jshint: {
+ all: ['Gruntfile.js', 'tasks/*.js'],
+ options: {
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "sub": true,
+ "undef": true,
+ "boss": true,
+ "eqnull": true,
+ "node": true
+ }
+ }
+ });
+
+ // These plugins provide necessary tasks.
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ // By default, lint and run all tests.
+ grunt.registerTask('default', ['jshint']);
+
+};
@@ -0,0 +1,22 @@
+Copyright (c) 2013 Jon Schlinkert
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,56 @@
+# grunt-sync-pkg [![NPM version](https://badge.fury.io/js/grunt-sync-pkg.png)](http://badge.fury.io/js/grunt-sync-pkg) [![Build Status](true.png)](true)
+
+> Minimalist Grunt plugin to sync only basic properties between package.json and bower.json
+
+This plugin syncs the following properties between `package.json` and `bower.json`:
+
+* `name`
+* `version`
+* `main`
+* `dependencies`
+* `devDependencies`
+
+Also, 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 :-).
+
+
+## Getting Started
+_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][Getting Started] and [package.json][], install this plugin with the following command:
+
+```bash
+npm install grunt-sync-pkg --save-dev
+```
+
+Once that's done, add this line to your project's Gruntfile:
+
+```js
+grunt.loadNpmTasks('grunt-sync-pkg');
+```
+
+If the plugin has been installed correctly, running `grunt --help` at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a `devDependency`, which ensures that it will be installed whenever the `npm install` command is run.
+
+[grunt]: http://gruntjs.com/
+[Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md
+[package.json]: https://npmjs.org/doc/json.html
+
+## Usage
+In the command line, run the plugin with `grunt sync`.
+
+## 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
+ * 2013-09-09   v0.1.0   First commit
+
+
+## License
+Copyright (c) 2013-09-09 Jon Schlinkert
+Licensed under the [MIT LICENSE](LICENSE-MIT).
+
+***
+
+Project created by [Jon Schlinkert](http://github.com/jonschlinkert).
+
+_This file was generated on 9/9/2013._
@@ -0,0 +1,37 @@
+{
+ "name": "grunt-sync-pkg",
+ "description": "Minimalist Grunt plugin to sync only basic properties between package.json and bower.json",
+ "version": "0.1.0",
+ "homepage": "https://github.com/jonschlinkert/grunt-sync-pkg",
+ "author": {
+ "name": "Jon Schlinkert",
+ "url": "https://github.com/jonschlinkert"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/jonschlinkert/grunt-sync-pkg.git"
+ },
+ "bugs": {
+ "url": "https://github.com/jonschlinkert/grunt-sync-pkg/issues"
+ },
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "https://github.com/jonschlinkert/grunt-sync-pkg/blob/master/LICENSE-MIT"
+ }
+ ],
+ "main": "Gruntfile.js",
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "scripts": {
+ "test": "grunt test"
+ },
+ "devDependencies": {
+ "grunt-contrib-jshint": "~0.6.0",
+ "grunt": "~0.4.1"
+ },
+ "keywords": [
+ "gruntplugin"
+ ]
+}
@@ -0,0 +1,40 @@
+/**
+ * grunt-sync-pkg
+ * http://github.com/jonschlinkert/grunt-sync-pkg
+ *
+ * Copyright (c) 2013 Jon Schlinkert, contributors
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function (grunt) {
+
+ grunt.registerTask('sync', 'Sync manifests.', function () {
+
+ // If bower.json doesn't exist yet, add one.
+ if (!grunt.file.exists('bower.json')) {
+ grunt.file.write('bower.json', "{}");
+ }
+
+ var bower = grunt.file.readJSON('bower.json');
+ var pkg = grunt.file.readJSON('package.json');
+ var _ = grunt.util._;
+
+ var options = this.options({
+ name: pkg.name,
+ version: pkg.version,
+ main: [pkg.main],
+ dependencies: pkg.dependencies || void 0,
+ devDependencies: pkg.devDependencies || void 0
+ });
+
+ if (pkg.main || options.main) {
+ options.main = _.union([], [pkg.main], (options.main || ['']));
+ }
+
+ bower = JSON.stringify(_.extend(bower, options), null, 2);
+ grunt.file.write('bower.json', bower);
+ });
+
+};

0 comments on commit 18689d3

Please sign in to comment.