* grunt-init-jquery
* https://gruntjs.com/
*
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors
* Licensed under the MIT license.
*/
'use strict';
exports.description = 'Create a jQuery plugin, including QUnit unit tests.';
exports.notes = '_Project name_ should not contain "jquery" or "js" and ' +
'should be a unique ID not already in use at plugins.jquery.com. _Project ' +
'title_ should be a human-readable title, and doesn\'t need to contain ' +
'the word "jQuery", although it may. For example, a plugin titled "Awesome ' +
'Plugin" might have the name "awesome-plugin".' +
'\n\n'+
'For more information, please see the following documentation:' +
'\n\n'+
'Naming Your Plugin http://plugins.jquery.com/docs/names/\n' +
'Publishing Your Plugin http://plugins.jquery.com/docs/publish/\n' +
'Package Manifest http://plugins.jquery.com/docs/package-manifest/';
exports.after = 'You should now install project dependencies with _npm ' +
'install_. After that, you may execute project tasks with _grunt_. For ' +
'more information about installing and configuring Grunt, please see ' +
'the Getting Started guide:' +
'\n\n' +
'http://gruntjs.com/getting-started';
exports.warnOn = '*';
exports.template = function(grunt, init, done) {
init.process({type: 'jquery'}, [
init.prompt('name'),
init.prompt('title', function(value, data, done) {
value = value.replace(/jquery/gi, 'jQuery');
done(null, value);
}),
init.prompt('description', 'The best jQuery plugin ever.'),
init.prompt('version'),
init.prompt('repository'),
init.prompt('homepage'),
init.prompt('bugs'),
init.prompt('licenses', 'MIT'),
init.prompt('author_name'),
init.prompt('author_email'),
init.prompt('author_url'),
init.prompt('jquery_version')
], function(err, props) {
props.jqueryjson = props.name + '.jquery.json';
props.dependencies = {jquery: props.jquery_version || '>= 1'};
props.keywords = [];
var files = init.filesToCopy(props);
init.addLicenseFiles(files, props.licenses);
init.copyAndProcess(files, props, {noProcess: 'libs/**'});
init.writePackageJSON('package.json', {
name: 'jquery-plugin',
version: '0.0.0-ignored',
npm_test: 'grunt qunit',
node_version: '>= 0.8.0',
devDependencies: {
'grunt-contrib-jshint': '~0.10.0',
'grunt-contrib-qunit': '~0.2.0',
'grunt-contrib-concat': '~0.3.0',
'grunt-contrib-uglify': '~0.2.0',
'grunt-contrib-watch': '~0.4.0',
'grunt-contrib-clean': '~0.4.0',
},
});
init.writePackageJSON(props.jqueryjson, props, function(pkg, props) {
if ('bugs' in props) { pkg.bugs = props.bugs; }
return pkg;
});
done();
});
};