forked from jmdobry/angular-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
127 lines (122 loc) · 3.64 KB
/
Gruntfile.js
File metadata and controls
127 lines (122 loc) · 3.64 KB
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
/*
* angular-cache
* http://jmdobry.github.io/angular-cache/
*
* Copyright (c) 2013-2015 Jason Dobry <http://jmdobry.github.io/angular-cache/>
* Licensed under the MIT license. <https://github.com/jmdobry/angular-cache/blob/master/LICENSE>
*/
module.exports = function (grunt) {
'use strict';
'use strict';
require('jit-grunt')(grunt, {
coveralls: 'grunt-karma-coveralls'
});
require('time-grunt')(grunt);
var webpack = require('webpack');
var pkg = grunt.file.readJSON('package.json');
var banner = 'angular-cache\n' +
'@version ' + pkg.version + ' - Homepage <http://jmdobry.github.io/angular-cache/>\n' +
'@author Jason Dobry <jason.dobry@gmail.com>\n' +
'@copyright (c) 2013-2015 Jason Dobry \n' +
'@license MIT <https://github.com/jmdobry/angular-cache/blob/master/LICENSE>\n' +
'\n' +
'@overview angular-cache is a very useful replacement for Angular\'s $cacheFactory.';
// Project configuration.
grunt.initConfig({
pkg: pkg,
clean: {
dist: ['dist/'],
coverage: ['coverage/']
},
watch: {
files: ['src/**/*.js'],
tasks: ['build']
},
uglify: {
main: {
options: {
report: 'min',
sourceMap: true,
sourceMapName: 'dist/angular-cache.min.map',
banner: '/*!\n' +
'* angular-cache\n' +
'* @version <%= pkg.version %> - Homepage <http://jmdobry.github.io/angular-cache/>\n' +
'* @author Jason Dobry <jason.dobry@gmail.com>\n' +
'* @copyright (c) 2013-2015 Jason Dobry <http://www.pseudobry.com>\n' +
'* @license MIT <https://github.com/jmdobry/angular-cache/blob/master/LICENSE>\n' +
'*\n' +
'* @overview angular-cache is a very useful replacement for Angular\'s $cacheFactory.\n' +
'*/\n'
},
files: {
'dist/angular-cache.min.js': ['dist/angular-cache.js']
}
}
},
webpack: {
dist: {
entry: './src/index.js',
output: {
filename: './dist/angular-cache.js',
libraryTarget: 'umd',
library: 'angularCacheModuleName'
},
externals: {
'angular': 'angular'
},
module: {
loaders: [
{ test: /(src)(.+)\.js$/, exclude: /node_modules/, loader: 'babel-loader?blacklist=useStrict' }
],
preLoaders: [
{
test: /(src)(.+)\.js$|(test)(.+)\.js$/, // include .js files
exclude: /node_modules/, // exclude any and all files in the node_modules folder
loader: "jshint-loader?failOnHint=true"
}
]
},
plugins: [
new webpack.BannerPlugin(banner)
]
}
},
karma: {
options: {
configFile: './karma.conf.js'
},
dist: {},
dev: {
browsers: ['Chrome'],
autoWatch: true,
singleRun: false
},
min: {
browsers: ['Chrome', 'Firefox', 'PhantomJS'],
options: {
files: [
'bower_components/angular-1.2.25/angular.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-mocks-1.2.25/angular-mocks.js',
'dist/angular-cache.min.js',
'./karma.start.js',
'test/**/*.js'
]
}
}
},
coveralls: {
options: {
coverage_dir: 'coverage'
}
}
});
grunt.registerTask('test', ['build', 'karma:dist', 'karma:min']);
grunt.registerTask('build', [
'clean',
'webpack',
'uglify'
]);
grunt.registerTask('default', ['build']);
grunt.registerTask('go', ['build', 'watch']);
};