forked from flowjs/flow.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
132 lines (129 loc) · 3.37 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
module.exports = function(grunt) {
var browsers = grunt.option('browsers') && grunt.option('browsers').split(',');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
},
build: {
src: 'dist/flow.js',
dest: 'dist/flow.min.js'
}
},
concat: {
build: {
files: {
'dist/flow.js': [
'src/flow.js'
]
}
}
},
jst: {
compile: {
options: {
},
files: {
"dist/flow.js": ["dist/flow.js"]
}
}
},
coveralls: {
options: {
coverage_dir: 'coverage/'
}
},
karma: {
options: {
configFile: 'karma.conf.js',
browsers: browsers || ['Chrome']
},
watch: {
autoWatch: true,
background: false
},
continuous: {
singleRun: true
},
coverage: {
singleRun: true,
reporters: ['progress', 'coverage'],
preprocessors: {
'src/*.js': 'coverage'
},
coverageReporter: {
type: "lcov",
dir: "coverage/"
}
},
travis: {
singleRun: true,
reporters: ['progress', 'coverage'],
preprocessors: {
'src/*.js': 'coverage'
},
coverageReporter: {
type: "lcov",
dir: "coverage/"
},
// Buggiest browser
browsers: browsers || ['sl_chrome'],
// global config for SauceLabs
sauceLabs: {
username: grunt.option('sauce-username') || process.env.SAUCE_USERNAME,
accessKey: grunt.option('sauce-access-key') || process.env.SAUCE_ACCESS_KEY,
startConnect: grunt.option('sauce-local') ? false : true ,
testName: 'flow.js'
}
}
},
clean: {
release: ["dist/"]
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'], // '-a' for all files
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
}
},
'template': {
'release': {
'options': {
'data': {
'version': '<%= pkg.version %>'
}
},
'files': {
'dist/flow.js': ['dist/flow.js']
}
}
}
});
// Loading dependencies
for (var key in grunt.file.readJSON("package.json").devDependencies) {
if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
}
// Default task.
grunt.registerTask('default', ['test']);
// Release tasks
grunt.registerTask('build', ['concat', 'template', 'uglify']);
grunt.registerTask('release', function(type) {
type = type ? type : 'patch';
grunt.task.run('bump-only:' + type);
grunt.task.run('clean', 'build');
grunt.task.run('bump-commit');
});
// Development
grunt.registerTask('test', ["karma:travis"]);
};