-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
143 lines (130 loc) · 4.65 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
module.exports = function (grunt) {
'use strict';
// Force use of Unix newlines
grunt.util.linefeed = '\n';
let releaseDir = 'rrerm_release',
nodeDir = 'node_modules',
vendorDir = 'vendor';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: ['_locales/**/.json', 'js/*.js', 'less/*.less', 'vendor/**/*.css', 'vendor/**/*.js', '*.html'],
tasks: ['build'],
options: {
spawn: false
}
}
},
clean: {
vendor: [vendorDir]
},
uglify : {
build : {
src : [nodeDir + '/chrome-badge-animator/src/BadgeAnimator.js'],
dest : vendorDir + '/chrome-badge-animator/dist/BadgeAnimator.min.js'
}
},
copy: {
'bootstrap': {
files: [{
expand: true,
src: [nodeDir + '/bootstrap/dist/css/*.min.css'], dest: vendorDir + '/bootstrap/dist/css',
flatten: true
},{
expand: true,
src: [nodeDir + '/bootstrap/dist/js/*.min.js'], dest: vendorDir + '/bootstrap/dist/js',
flatten: true
}]
},
'bootstrap-select': {
files: [{
expand: true,
src: [nodeDir + '/bootstrap-select/dist/css/*.min.css'], dest: vendorDir + '/bootstrap-select/dist/css',
flatten: true
},{
expand: true,
src: [nodeDir + '/bootstrap-select/dist/js/*.min.js'], dest: vendorDir + '/bootstrap-select/dist/js',
flatten: true
}]
},
'chart.js': {
files: [{
expand: true,
src: [nodeDir + '/chart.js/dist/*.min.js'], dest: vendorDir + '/chart.js/dist/',
flatten: true
}]
},
'jquery': {
files: [{
expand: true,
src: [nodeDir + '/jquery/dist/*.min.js'], dest: vendorDir + '/jquery/dist/',
flatten: true
}]
},
main: {
files: [
{expand: true, src: ['_locales/**'], dest: releaseDir},
{expand: true, src: ['img/*'], dest: releaseDir},
{expand: true, src: ['sounds/*'], dest: releaseDir},
{expand: true, src: ['vendor/**'], dest: releaseDir},
{expand: true, src: ['views/*.html'], dest: releaseDir},
{expand: true, src: ['manifest.json'], dest: releaseDir}
]
}
},
less: {
production: {
options: {
path: ['css']
},
files: {
'rrerm_release/css/popup.css': 'less/popup.less',
'rrerm_release/css/donate.css': 'less/donate.less',
'rrerm_release/css/options.css': 'less/options.less'
}
}
},
terser: {
main: {
options: {
compress: true,
mangle: true
},
files: [
{expand: true, src: 'js/*.js', dest: releaseDir},
]
}
},
compress: {
main: {
options: {
archive: 'oldPackages/<%= pkg.short %><%= pkg.version %>.zip'
},
files: [
{src: [releaseDir + '/**'], dest: '/'}
]
},
firefox: {
options: {
archive: 'oldPackages/<%= pkg.short %><%= pkg.version %>_firefox.zip'
},
files: [{
src: ['**/*'],
cwd: releaseDir,
expand: true
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-terser');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['less']);
grunt.registerTask('build', ['uglify', 'copy', 'terser', 'less']);
grunt.registerTask('pack', ['compress']);
grunt.registerTask('release', ['uglify', 'copy', 'terser', 'less', 'compress']);
};