forked from MrSwitch/hello.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
108 lines (103 loc) · 2.76 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
module.exports = function(grunt) {
var source = ['Gruntfile.js', 'src/**/*.js', 'tests/**/*.js', '!tests/specs/libs/**/*'];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
src: source,
options: {
globals: {
console: true,
module: true,
document: true
},
sub: true,
es3: true
}
},
jscs: {
src: source,
options: {
config: '.jscsrc'
}
},
mocha_phantomjs: {
all: ['tests/specs/index.html']
},
bumpup: ['package.json'],
shunt: {
build: {
'dist/hello.js': [
'src/hello.polyfill.js',
'src/hello.js',
'src/hello.chromeapp.js',
'src/hello.phonegap.js',
'src/hello.amd.js',
'src/hello.commonjs.js'
],
'dist/hello.all.js': [
'src/hello.polyfill.js',
'src/hello.js',
'src/hello.chromeapp.js',
'src/hello.phonegap.js',
'src/modules/dropbox.js',
'src/modules/facebook.js',
'src/modules/flickr.js',
'src/modules/foursquare.js',
'src/modules/github.js',
'src/modules/google.js',
'src/modules/instagram.js',
'src/modules/joinme.js',
'src/modules/linkedin.js',
'src/modules/soundcloud.js',
'src/modules/spotify.js',
'src/modules/twitter.js',
'src/modules/vk.js',
'src/modules/windows.js',
'src/modules/yahoo.js',
'src/hello.amd.js',
'src/hello.commonjs.js'
]
}
},
uglify: {
minify: {
files: {
'dist/hello.min.js': ['dist/hello.js'],
'dist/hello.all.min.js': ['dist/hello.all.js']
}
}
},
usebanner: {
build: {
options: {
position: 'top',
banner: '/*! <%= pkg.name %> v<%= pkg.version %> | (c) 2012-<%= (new Date()).getFullYear() %> <%= pkg.author.name %> | <%= pkg.license %> <%= pkg.homepage %>/LICENSE */',
linebreak: true
},
files: {
src: ['dist/hello.*']
}
}
},
watch: {
files: ['src/**/*.js', 'tests/specs/**/*'],
tasks: ['test']
}
});
grunt.loadNpmTasks('grunt-banner');
grunt.loadNpmTasks('grunt-bumpup');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('browserstack-runner');
grunt.loadNpmTasks('shunt');
grunt.registerTask('mocha', ['mocha_phantomjs']);
grunt.registerTask('test', ['jscs', 'jshint', 'mocha']);
grunt.registerTask('deploy', ['test', 'shunt:build', 'uglify:minify', 'bumpup', 'updateInitConfig', 'usebanner:build']);
grunt.registerTask('default', ['test', 'shunt:build', 'uglify:minify', 'usebanner:build']);
grunt.registerTask('updateInitConfig', 'Redefine pkg after change in package.json', function() {
grunt.config.set('pkg', grunt.file.readJSON('package.json'));
});
};