-
Notifications
You must be signed in to change notification settings - Fork 147
/
Gruntfile.js
176 lines (153 loc) · 4.42 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
module.exports = function (grunt) {
var pkg = grunt.file.readJSON('package.json');
// Project configuration.
grunt.initConfig({
pkg: pkg,
eslint: {
options: {
config: '.eslintrc',
},
all: [
'Gruntfile.js',
'lib/**/*.js',
'test/test.js',
],
},
browserify: {
main: {
files: {
'dist/highland.js': ['lib/index.js'],
},
options: {
browserifyOptions: {
standalone: 'highland',
},
},
},
'test-browser': {
files: {
'test/bundle.js': ['test/browser.js'],
},
options: {
exclude: 'lib/**',
},
},
},
uglify: {
main: {
options: {
// Restore v1.x IE8 behavior to guarantee compatibility. We
// may not need it.
screwIE8: false,
},
files: {
'dist/highland.min.js': ['dist/highland.js'],
},
},
},
nodeunit: {
all: ['test/test.js'],
},
watch: {
all: {
files: ['lib/index.js'],
tasks: ['test'],
},
},
'gh-pages': {
options: {
base: 'docs',
},
src: ['**'],
},
bump: {
options: {
files: ['package.json'],
updateConfigs: ['pkg'],
push: false,
pushTo: 'origin',
commit: true,
commitMessage: 'Release %VERSION%',
commitFiles: ['package.json', 'dist/highland.js', 'dist/highland.min.js', 'docs/index.html'],
prereleaseName: 'beta',
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%',
},
},
'npm-publish': {
options: {
// list of tasks that are required before publishing
requires: [],
// if the workspace is dirty, abort publishing
// (to avoid publishing local changes)
abortIfDirty: true,
tag: function () {
if (pkg.version.indexOf('beta') < 0) {
return 'latest';
}
else {
return 'next';
}
},
},
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-npm');
// custom tasks
grunt.loadTasks('./tasks');
grunt.registerTask('pre-release:beta', [
'test',
'bump-only:prerelease',
'build',
'bump-commit',
]);
grunt.registerTask('pre-release:patch', [
'test',
'bump-only:patch',
'build',
'bump-commit',
]);
grunt.registerTask('pre-release:minor', [
'test',
'bump-only:minor',
'build',
'bump-commit',
]);
grunt.registerTask('pre-release:major', [
'test',
'bump-only:major',
'build',
'bump-commit',
]);
grunt.registerTask('release:beta', [
'pre-release:beta',
'npm-publish',
]);
grunt.registerTask('release:patch', [
'pre-release:patch',
'npm-publish',
'gh-pages',
]);
grunt.registerTask('release:minor', [
'pre-release:minor',
'npm-publish',
'gh-pages',
]);
grunt.registerTask('release:major', [
'pre-release:major',
'npm-publish',
'gh-pages',
]);
grunt.registerTask('build-browser-tests', ['build', 'browserify:test-browser']);
grunt.registerTask('test', ['eslint:all', 'nodeunit:all']);
grunt.registerTask('build', ['browserify:main', 'uglify:main', 'docs']);
grunt.registerTask('default', ['build']);
};