-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.js
More file actions
108 lines (92 loc) · 3.57 KB
/
template.js
File metadata and controls
108 lines (92 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* grunt-init-basic
* https://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman, Jan Panschab, contributors
* Licensed under the MIT license.
*/
'use strict';
// Nodejs libs.
var path = require('path');
// Basic template description.
exports.description = 'Create a basic project inculde LESS, Browserify, React and jQuery.';
// Template-specific notes to be displayed before question prompts.
exports.notes = '_Project name_ should be a unique ID. _Project ' +
'title_ should be a human-readable title.';
// Template-specific notes to be displayed after question prompts.
exports.after = 'You should now install project dependencies with _npm ' +
'install && bower 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';
// Any existing file or directory matching this wildcard will cause a warning.
exports.warnOn = '*';
// The actual init template.
exports.template = function(grunt, init, done) {
init.process({
type: 'basic'
}, [
// Prompt for these values.
init.prompt('name'),
init.prompt('title', function(value, data, done) {
done(null, value);
}),
init.prompt('description', 'Best project ever.'),
init.prompt('version'),
init.prompt('repository', function(value, data, done) {
done(null, 'git://github.com/actum/' + data.name + '.git');
}),
init.prompt('homepage', function(value, data, done) {
done(null, 'http://www.' + data.name + '.cz/');
}),
init.prompt('bugs'),
init.prompt('licenses', 'MIT'),
init.prompt('author_name', 'Actum'),
init.prompt('author_email', 'actum@actum.cz'),
init.prompt('author_url', 'http://www.actum.cz/')
], function(err, props) {
// A few additional properties.
props.basicjson = props.name + '.json';
props.keywords = [];
// Files to copy (and process).
var files = init.filesToCopy(props);
// Add properly-named license files.
init.addLicenseFiles(files, props.licenses);
// Actually copy (and process) files.
init.copyAndProcess(files, props, {
noProcess: 'libs/**'
});
// Generate package.json file, used by npm and grunt.
init.writePackageJSON('package.json', {
name: 'basic-project',
version: '0.0.0-ignored',
// TODO: pull from grunt's package.json
node_version: '>= 0.8.0',
devDependencies: {
'assemble': '~0.4.42',
'grunt': '^0.4.5',
'grunt-browser-sync': '^1.5.2',
'grunt-browserify': '~3.2.1',
'grunt-cache-bust': '^0.4.5',
'grunt-contrib-clean': '~0.6.0',
'grunt-contrib-copy': '~0.7.0',
'grunt-contrib-cssmin': '^0.10.0',
'grunt-contrib-jshint': '~0.10.0',
'grunt-contrib-less': '~0.12.0',
'grunt-contrib-uglify': '~0.6.0',
'grunt-este-watch': '^0.1.18',
'grunt-jscs': '~1.0.0',
'grunt-react': '^0.9.0',
'jit-grunt': '~0.9.0',
'jshint-stylish': '~1.0.0'
},
});
// Generate project.json file.
init.writePackageJSON(props.basicjson, props, function(pkg, props) {
return pkg;
});
// All done!
done();
});
};