-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtemplate.js
83 lines (72 loc) · 2.35 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
/*
* grunt-init-openrov-plugin
* https://openrov.com/
*
* Copyright (c) 2014 OpenROV Inc, contributors
* Licensed under the MIT license.
*/
'use strict';
// Basic template description.
exports.description = 'Creates the scaffolding for an OpenROV Cockpit plugin';
// Template-specific notes to be displayed before question prompts.
exports.notes = '_Project name_ should not contain "openrov-plugin" as it will be added automatically and ' +
'should be a unique ID not already in use. _Project ' +
'title_ should be a human-readable title, and doesn\'t need to contain ' +
'the word "jQuery", although it may. ';
// Template-specific notes to be displayed after question prompts.
exports.after = 'If you have not already, be sure to run git init to initalize your repository. ' +
'When you are ready to publish, use:' +
'\n\n' +
'$ bower register <my-package-name> <git-endpoint>';
// 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({}, [
// Prompt for these values.
init.prompt('name'),
init.prompt('description'),
init.prompt('main'),
init.prompt('version','0.0.0'),
init.prompt('author_name'),
init.prompt('author_email'),
init.prompt('homepage'),
init.prompt('licenses')
], function(err, props) {
// Files to copy (and process).
var files = init.filesToCopy(props);
// Actually copy (and process) files.
init.copyAndProcess(files, props);
// Add properly-named license files.
init.addLicenseFiles(files, props.licenses);
// Generate package.json file, used by npm and grunt.
init.writePackageJSON('bower.json', {
name: 'openrov-plugin-' + props.name,
main: props.main,
version: props.version,
authors: [
props.author_name + '<' + props.author_email + '>'
],
description: props.description,
moduleType: [
'es6',
'node'
],
keywords: [
'openrov',
'plugin'
],
license: props.licenses,
homepage: props.homepage,
ignore: [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
});
// All done!
done();
});
};