-
Notifications
You must be signed in to change notification settings - Fork 3
/
gruntfile.js
131 lines (123 loc) · 3.8 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
archive_name: 'shazify-<%= pkg.version %>',
jshint: {
options: {
globals: { angular: true },
ignores: 'src/background/lib/*'
},
all: ['gruntfile.js', 'src/popup/js/**/*.js', 'src/background/**/*.js'],
gruntfile: ['gruntfile.js']
},
concat: {
options: {
separator: '\n\n',
},
css: {
files: {
'popup/popup.css': ['src/popup/css/*.css'],
'contentscripts/shazam.css': ['src/contentscripts/shazam.css']
}
},
js: {
files: {
'contentscripts/shazamLocalStorage.js': [
'src/contentscripts/shazamLocalStorage.js'
],
'popup/popup.js': [
'src/popup/js/app.js',
'src/popup/js/**/*.js'
],
'background/background.js': [
'src/background/lib/*.js',
'src/background/background.js',
'src/background/Helper.js',
'src/background/ChromeHelper.js',
'src/background/CanvasIcon.js',
'src/background/DbService.js',
'src/background/LoggerService.js',
'src/background/StorageHelper.js',
'src/background/SpotifyService.js',
'src/background/ShazamService.js',
'src/background/TagsService.js',
'src/background/UpdateService.js',
]
}
}
},
watch: {
gruntfile: {
files: 'gruntfile.js',
tasks: ['jshint:gruntfile'],
options: {
spawn: false,
}
},
css: {
files: ['src/popup/css/*.css', 'src/contentscripts/*.css'],
tasks: ['build:css'],
options: {
spawn: false,
}
},
js: {
files: ['src/contentscripts/*.js', 'src/popup/js/**/*.js', 'src/background/**/*.js'],
tasks: ['build:js'],
options: {
spawn: false,
}
}
},
clean: {
pre: ['dist/', 'build/'],
post: ['<%= archive_name %>.zip', 'build/']
},
compress: {
main: {
options: {
archive: '<%= archive_name %>.zip'
},
expand: true,
cwd: 'build/',
src: ['**/*'],
dest: ''
}
},
copy: {
contentScriptsImg: {
files: [
{expand: true, flatten: true, src: ['src/contentscripts/img/**'], dest: 'contentscripts/img/'},
]
},
main: {
files: [
{expand: true, src: ['_locales/**'], dest: 'build/'},
{expand: true, src: ['icons/**'], dest: 'build/'},
{expand: true, src: ['background/**'], dest: 'build/'},
{expand: true, src: ['contentscripts/**'], dest: 'build/'},
{expand: true, src: ['popup/**'], dest: 'build/'},
{expand: true, src: ['static/**'], dest: 'build/'},
{expand: true, src: ['LICENCE'], dest: 'build/'},
{expand: true, src: ['manifest.json'], dest: 'build/'},
{expand: true, src: ['README.md'], dest: 'build/'}
]
},
archive: {
files: [
{expand: true, src: ['<%= archive_name %>.zip'], dest: 'dist/'}
]
}
},
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('build', ['concat:css', 'jshint', 'concat:js', 'copy:contentScriptsImg']);
grunt.registerTask('build:css', ['concat:css']);
grunt.registerTask('build:js', ['jshint', 'concat:js']);
grunt.registerTask('bundle', ['clean:pre', 'build', 'copy:main', 'compress', 'copy:archive', 'clean:post']);
};