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_ must start with "jquery." and should be a ' +
|
15 | 'unique ID not already in use at plugins.jquery.com. _Project title_ ' +
|
16 | 'should be a human-readable title, and doesn\'t need to contain the word ' +
|
17 | '"jQuery", although it may. For example, a plugin titled "Awesome Plugin" ' +
|
18 | 'might have the name "jquery.awesome-plugin".';
|
19 |
|
20 |
|
21 | exports.warnOn = '*';
|
22 |
|
23 |
|
24 | exports.template = function(grunt, init, done) {
|
25 |
|
26 | var task = grunt.task;
|
27 | var file = grunt.file;
|
28 | var utils = grunt.utils;
|
29 | var log = grunt.log;
|
30 | var verbose = grunt.verbose;
|
31 | var fail = grunt.fail;
|
32 | var option = grunt.option;
|
33 | var config = grunt.config;
|
34 | var template = grunt.template;
|
35 |
|
36 | grunt.helper('prompt', {type: 'jquery'}, [
|
37 |
|
38 | grunt.helper('prompt_for', 'name', function(value, data, done) {
|
39 |
|
40 | value = data.full_name = 'jquery.' + value;
|
41 | done(null, value);
|
42 | }),
|
43 | grunt.helper('prompt_for', 'title', function(value, data, done) {
|
44 |
|
45 | value = value.replace(/jquery/gi, 'jQuery');
|
46 | done(null, value);
|
47 | }),
|
48 | grunt.helper('prompt_for', 'description', 'The best jQuery plugin ever.'),
|
49 | grunt.helper('prompt_for', 'version'),
|
50 | grunt.helper('prompt_for', 'repository'),
|
51 | grunt.helper('prompt_for', 'homepage'),
|
52 | grunt.helper('prompt_for', 'bugs'),
|
53 | grunt.helper('prompt_for', 'licenses', 'MIT GPL'),
|
54 | grunt.helper('prompt_for', 'author_name'),
|
55 | grunt.helper('prompt_for', 'author_email'),
|
56 | grunt.helper('prompt_for', 'author_url'),
|
57 | grunt.helper('prompt_for', 'jquery_version')
|
58 | ], function(err, props) {
|
59 |
|
60 | var files = init.filesToCopy(props);
|
61 |
|
62 |
|
63 | init.addLicenseFiles(files, props.licenses);
|
64 |
|
65 |
|
66 | init.copyAndProcess(files, props, {noProcess: 'libs/**'});
|
67 |
|
68 |
|
69 | props.dependencies = {jquery: props.jquery_version || '1'};
|
70 |
|
71 |
|
72 | init.writePackageJSON('package.json', props);
|
73 |
|
74 |
|
75 | done();
|
76 | });
|
77 |
|
78 | };
|