-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGruntfile.js
142 lines (118 loc) · 4.92 KB
/
Gruntfile.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*!
docker-composer-manager 0.1.3, built on: 2017-10-30
Copyright (C) 2017 Daniel Arteaga
http://darteaga.com
https://github.com/dani8art/docker-compose-manager
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.*/
'use strict';
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-release-github');
grunt.loadNpmTasks('grunt-banner');
// Project configuration.
grunt.initConfig({
//Load configurations
pkg: grunt.file.readJSON('package.json'),
licenseNotice: grunt.file.read('extra/license-notice', {
encoding: 'utf8'
}).toString(),
latestReleaseNotes: grunt.file.read('extra/latest-release-notes', {
encoding: 'utf8'
}).toString(),
//Add license notice and latest release notes
usebanner: {
license: {
options: {
position: 'top',
banner: '/*!\n<%= licenseNotice %>*/\n',
replace: true
},
files: {
src: ['src/**/*.js', 'tests/**/*.js', 'Gruntfile.js'] //If you want to inspect more file, you change this.
}
},
readme: {
options: {
position: 'bottom',
banner: '## Copyright notice\n\n<%= latestReleaseNotes %>',
replace: /##\sCopyright\snotice(\s||.)+/g,
linebreak: false
},
files: {
src: ['README.md']
}
}
},
//Lint JS
jshint: {
all: ['Gruntfile.js', 'src/**/*.js', 'tests/**/*.js', 'index.js'], //If you want to inspect more file, you change this.
options: {
jshintrc: '.jshintrc'
}
},
//Execute mocha tests
mochaTest: {
tests: {
options: {
reporter: 'spec',
//captureFile: 'test.results<%= grunt.template.today("yyyy-mm-dd:HH:mm:ss") %>.txt', // Optionally capture the reporter output to a file
quiet: false, // Optionally suppress output to standard out (defaults to false)
clearRequireCache: false, // Optionally clear the require cache before running tests (defaults to false)
noFail: false // Optionally set to not fail on failed tests (will still fail on other errors)
},
src: ['tests/**/*.js']
}
},
//Make a new release on github
//"grunt release" for pacth version
//"grunt release:minior" for minior version
//"grunt release:major" for major version
release: {
options: {
packageObject: 'pkg',
changelog: true, //NOT CHANGE
changelogFromGithub: true, //NOT CHANGE
githubReleaseBody: 'See [CHANGELOG.md](./CHANGELOG.md) for details.', //NOT CHANGE
npm: true, //CHANGE TO TRUE IF YOUR PROJECT IS A NPM MODULE
//npmtag: true, //default: no tag
afterBump: ['build'], // IS NOT READY YET
updateVars: ['pkg'], //NOT CHANGE
github: {
repo: "dani8art/docker-compose-manager",
accessTokenVar: "GITHUB_ACCESS_TOKEN", //SET ENVIRONMENT VARIABLE WITH THIS NAME
usernameVar: "GITHUB_USERNAME" //SET ENVIRONMENT VARIABLE WITH THIS NAME
}
}
},
//IT IS RECOMENDED TO EXECUTE "grunt watch" while you are working.
watch: {
scripts: {
files: ['src/**/*.js'],
tasks: ['jshint']
}
},
});
grunt.registerTask('buildOn', function () {
grunt.config('pkg.buildOn', grunt.template.today("yyyy-mm-dd"));
grunt.file.write('package.json', JSON.stringify(grunt.config('pkg'), null, 2));
});
// Default task(s).
grunt.registerTask('default', ['jshint', 'usebanner']);
//TEST TASK
grunt.registerTask('test', ['jshint', 'mochaTest']);
//BUILD TASK
grunt.registerTask('build', ['buildOn', 'usebanner']);
//DEVELOPMENT TASK
grunt.registerTask('dev', ['watch']);
};