UNPKG

1.64 kBJavaScriptView Raw
1/*
2 * grunt
3 * http://gruntjs.com/
4 *
5 * Copyright (c) 2012 "Cowboy" Ben Alman
6 * Licensed under the MIT license.
7 * https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
8 */
9
10// Basic template description.
11exports.description = 'Create a commonjs module, including Nodeunit unit tests.';
12
13// Template-specific notes to be displayed before question prompts.
14exports.notes = '';
15
16// Any existing file or directory matching this wildcard will cause a warning.
17exports.warnOn = '*';
18
19// The actual init template.
20exports.template = function(grunt, init, done) {
21
22 grunt.helper('prompt', {}, [
23 // Prompt for these values.
24 grunt.helper('prompt_for', 'name'),
25 grunt.helper('prompt_for', 'description'),
26 grunt.helper('prompt_for', 'version'),
27 grunt.helper('prompt_for', 'repository'),
28 grunt.helper('prompt_for', 'homepage'),
29 grunt.helper('prompt_for', 'bugs'),
30 grunt.helper('prompt_for', 'licenses'),
31 grunt.helper('prompt_for', 'author_name'),
32 grunt.helper('prompt_for', 'author_email'),
33 grunt.helper('prompt_for', 'author_url'),
34 grunt.helper('prompt_for', 'node_version', '*'),
35 grunt.helper('prompt_for', 'main'),
36 grunt.helper('prompt_for', 'npm_test')
37 ], function(err, props) {
38 props.keywords = [];
39
40 // Files to copy (and process).
41 var files = init.filesToCopy(props);
42
43 // Add properly-named license files.
44 init.addLicenseFiles(files, props.licenses);
45
46 // Actually copy (and process) files.
47 init.copyAndProcess(files, props);
48
49 // Generate package.json file.
50 init.writePackageJSON('package.json', props);
51
52 // All done!
53 done();
54 });
55
56};