{"name":"gruntfile-editor","version":"1.2.0","description":"API to modify the content of a Gruntfile.js file","author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"files":["lib"],"main":"lib/index.js","keywords":["gruntfile","ast"],"license":"MIT","scripts":{"test":"gulp","prepublish":"gulp prepublish"},"repository":{"type":"git","url":"git+https://github.com/sboudrias/gruntfile-editor.git"},"dependencies":{"ast-query":"^1.0.1","lodash":"^4.6.1"},"devDependencies":{"mocha":"^2.1.0","eslint":"^2.1.0","eslint-config-xo-space":"^0.10.0","gulp":"^3.9.0","gulp-eslint":"^2.0.0","gulp-exclude-gitignore":"^1.0.0","gulp-line-ending-corrector":"^1.0.1","gulp-istanbul":"^0.10.3","gulp-mocha":"^2.0.0","gulp-plumber":"^1.0.0","gulp-nsp":"^2.1.0","gulp-coveralls":"^0.1.0"},"eslintConfig":{"extends":"xo-space","env":{"mocha":true},"rules":{"eqeqeq":[2,"allow-null"],"no-eq-null":0}},"gitHead":"750c1ecef4f5fc9c234de7e23c100a00c8e3a3b3","bugs":{"url":"https://github.com/sboudrias/gruntfile-editor/issues"},"homepage":"https://github.com/sboudrias/gruntfile-editor#readme","_id":"gruntfile-editor@1.2.0","_shasum":"169cc7ff532f0b2eb900eec351f7a2bf668302d0","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.9.0","_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"dist":{"shasum":"169cc7ff532f0b2eb900eec351f7a2bf668302d0","tarball":"http://registry-npm.ywwl.com/gruntfile-editor/download/gruntfile-editor-1.2.0.tgz","integrity":"sha512-OGok0Dhdbh5ZloA+/ABl2KqXBS4LzujeWZXh5QLekx54Z4LxaC8hTyNfnqsBVrJjFNJOfGRyQZLhQeZko7ovaA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpD9Xowj1QWWCRdwlpBPEVl29v/NIw9CrAj7M0MvS91wIhANKgpg42ymIk5vdNvVlGMTfT8kFpg0vHHXE6OP4O18PT"}],"size":3466,"noattachment":false,"key":"/gruntfile-editor/-/gruntfile-editor-1.2.0.tgz"},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/gruntfile-editor-1.2.0.tgz_1459233959485_0.7322243058588356"},"directories":{},"readme":"Gruntfile Editor\n================\n\n[![npm](https://badge.fury.io/js/gruntfile-editor.svg)](http://badge.fury.io/js/gruntfile-editor) [![tests](https://travis-ci.org/SBoudrias/gruntfile-editor.svg?branch=master)](https://travis-ci.org/SBoudrias/gruntfile-editor) [![Coverage Status](https://coveralls.io/repos/github/SBoudrias/gruntfile-editor/badge.svg?branch=master)](https://coveralls.io/github/SBoudrias/gruntfile-editor?branch=master) [![dependencies](https://david-dm.org/SBoudrias/gruntfile-editor.svg?theme=shields.io)](https://david-dm.org/SBoudrias/gruntfile-editor)\n\nAn API to modify a `Gruntfile.js` content\n\nInstallation\n---------------\n\n```\nnpm install --save gruntfile-editor\n```\n\nExample\n---------------\n\n```javascript\nvar GruntfileEditor = require('gruntfile-editor');\nvar editor = new GruntfileEditor();\n\neditor.insertConfig('compass', '{ foo: \"bar\" }');\n\nfs.writeFileSync('Gruntfile.js', editor.toString());\n```\n\nAPI\n--------------\n\n### `new GruntfileEditor( content )`\n\nCreate a new editor instance. You can pass the content of the Gruntfile to edit to the constructor. If no content is provided, a default file structure is used.\n\n### `editor.insertConfig( name, config )`\n\nInsert a configuration block inside the `grunt.initConfig()` call.\n\n### `editor.registerTask( name, tasks )`\n\nRegister a task inside a named task group\n\n```javascript\neditor.registerTask('build', 'compass');\n// output: grunt.registerTask('build', ['compass']);\n\neditor.registerTask('build', ['compass', 'uglify']);\n// output: grunt.registerTask('build', ['compass', 'uglify']);\n```\n\nYou can specify an optional description.\n\n```javascript\neditor.registerTask('build', 'A task description', ['compass', 'uglify']);\n// output: grunt.registerTask('build', 'A task description', ['compass', 'uglify']);\n```\n\n### `editor.insertVariable( name, value )`\n\nInsert a variable to the top of the Gruntfile.\n\n```javascript\neditor.insertVariable('root', '\"project/foo\"');\n// output: var root = 'project/foo';\n```\n\n### `editor.prependJavaScript( code )`\n\nInsert a piece of arbritary JavaScript code to the top of the Gruntfile.\n\n```javascript\neditor.prependJavaScript('require(\\'load-grunt-tasks\\')(grunt);');\n// output: require('load-grunt-tasks')(grunt);\n```\n\n### `editor.loadNpmTasks( pluginName )`\n\nLoad a Grunt plugin.\n\n```javascript\neditor.loadNpmTasks('grunt-contrib-uglify');\n// output: grunt.loadNpmTasks(\"grunt-contrib-uglify\");\n\neditor.loadNpmTasks(['grunt-contrib-uglify', 'grunt-contrib-concat']);\n// output:\n// grunt.loadNpmTasks(\"grunt-contrib-concat\");\n// grunt.loadNpmTasks(\"grunt-contrib-uglify\");\n```\n\n\n### `editor.toString()`\n\nReturns the modified Gruntfile as a string.\n\nLicence\n-----------\n\nCopyright (c) 2012 Simon Boudrias (twitter: @vaxilart)  \nLicensed under the MIT license.\n","publish_time":1459233959914,"_cnpm_publish_time":1459233959914,"dist-tags":{"latest":"1.2.1"}}