1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | exports.description = 'Create a jQuery plugin, including QUnit unit tests.';
|
12 |
|
13 |
|
14 | exports.notes = '_Project name_ should not contain "jquery" or "js" and ' +
|
15 | 'should be a unique ID not already in use at plugins.jquery.com. _Project ' +
|
16 | 'title_ should be a human-readable title, and doesn\'t need to contain ' +
|
17 | 'the word "jQuery", although it may. For example, a plugin titled "Awesome ' +
|
18 | 'jQuery Plugin" might have the name "awesome-plugin". For more information ' +
|
19 | 'please see the documentation at ' +
|
20 | 'https://github.com/jquery/plugins.jquery.com/blob/master/docs/manifest.md';
|
21 |
|
22 |
|
23 | exports.warnOn = '*';
|
24 |
|
25 |
|
26 | exports.template = function(grunt, init, done) {
|
27 |
|
28 | grunt.helper('prompt', {type: 'jquery'}, [
|
29 |
|
30 | grunt.helper('prompt_for', 'name'),
|
31 | grunt.helper('prompt_for', 'title', function(value, data, done) {
|
32 |
|
33 | value = value.replace(/jquery/gi, 'jQuery');
|
34 | done(null, value);
|
35 | }),
|
36 | grunt.helper('prompt_for', 'description', 'The best jQuery plugin ever.'),
|
37 | grunt.helper('prompt_for', 'version'),
|
38 | grunt.helper('prompt_for', 'repository'),
|
39 | grunt.helper('prompt_for', 'homepage'),
|
40 | grunt.helper('prompt_for', 'bugs'),
|
41 | grunt.helper('prompt_for', 'licenses', 'MIT'),
|
42 | grunt.helper('prompt_for', 'author_name'),
|
43 | grunt.helper('prompt_for', 'author_email'),
|
44 | grunt.helper('prompt_for', 'author_url'),
|
45 | grunt.helper('prompt_for', 'jquery_version')
|
46 | ], function(err, props) {
|
47 |
|
48 | props.jqueryjson = props.name + '.jquery.json';
|
49 | props.dependencies = {jquery: props.jquery_version || '>= 1'};
|
50 | props.keywords = [];
|
51 |
|
52 |
|
53 | var files = init.filesToCopy(props);
|
54 |
|
55 |
|
56 | init.addLicenseFiles(files, props.licenses);
|
57 |
|
58 |
|
59 | init.copyAndProcess(files, props, {noProcess: 'libs/**'});
|
60 |
|
61 |
|
62 | init.writePackageJSON('package.json', {
|
63 | name: 'jquery-plugin',
|
64 | version: '0.0.0-ignored',
|
65 | npm_test: 'grunt qunit',
|
66 |
|
67 | node_version: '>= 0.6.0',
|
68 | });
|
69 |
|
70 |
|
71 | init.writePackageJSON(props.jqueryjson, props);
|
72 |
|
73 |
|
74 | done();
|
75 | });
|
76 |
|
77 | };
|