-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.js
108 lines (95 loc) · 2.99 KB
/
template.js
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-frontend
* https://github.com./Everhard/grunt-init-frontend
*
* Copyright (c) 2016 Andrew Dorokhov
* https://dorokhov.dev
* Licensed under the MIT license.
*/
'use strict';
/**
* Basic template description.
*
* @type {string}
*/
exports.description = 'This is an easy to install grunt template to start developing your frontend in seconds.';
/**
* Template-specific notes to be displayed before question prompts.
*
* @type {string}
*/
exports.notes = 'Thank you for using this template! ' +
'Take a look at the https://github.com./Everhard/grunt-init-frontend repo before using.';
/**
* Template-specific notes to be displayed after question prompts.
*
* @type {string}
*/
exports.after = 'You should now install project dependencies with _npm ' +
'install_. After that, you may execute project tasks with _grunt_.';
/**
* Any existing file or directory matching this wildcard will cause a warning.
*
* @type {string}
*/
exports.warnOn = '*';
/**
* The actual init template.
*
* @param grunt
* @param init
* @param done
*/
exports.template = function(grunt, init, done) {
const userValues = [
init.prompt('name', 'my-project'),
init.prompt('description', 'My awesome project'),
init.prompt('author_name'),
init.prompt('author_email'),
init.prompt('author_url'),
init.prompt('repository')
];
init.process({'version':'0.1.0'}, userValues, function(err, props) {
// Files to copy (and process).
const files = init.filesToCopy(props);
// Actually copy (and process) files.
init.copyAndProcess(files, props);
// Generate package.json file, used by npm and grunt.
init.writePackageJSON('package.json', {
name: props.name,
version: props.version,
author_name: props.author_name,
author_email: props.author_email,
author_url: props.author_url,
repository: {
type: "git",
url: props.repository
},
devDependencies: {
"grunt": "^1.6.1",
"bower": "^1.8.14",
"grunt-includes": "^1.1.0",
"grunt-contrib-concat": "^2.1.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jshint": "^3.2.0",
"grunt-contrib-cssmin": "^5.0.0",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-uglify": "^5.2.2",
"grunt-remove-logging": "^0.2.0",
"grunt-contrib-watch": "^1.1.0",
"@lodder/grunt-postcss": "^3.1.1",
"autoprefixer": "^10.4.20",
}
});
// Generate bower.json file, used by bower.
init.writePackageJSON('bower.json', {
name: props.name,
dependencies: {
"bootstrap": "^5.3.3",
"normalize-css": "normalize.css#^8.0.1"
}
});
// All done!
done();
});
};