-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
108 lines (106 loc) · 4.16 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) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
manifest: require('./src/manifest.json'),
clean: {
build: ['dist/*']
},
copy: {
production: {
files: [
{
expand: true,
cwd: 'src',
src: ['**', '!assets/logo-dev/**'],
dest: 'dist/production/',
},
{
src: 'node_modules/jszip/dist/jszip.min.js',
dest: 'dist/production/scripts/jszip.min.js'
}
]
},
development: {
files: [
{
expand: true,
cwd: 'src',
src: ['**', '!assets/logo-dev/**', '!assets/logo/**'],
dest: 'dist/development/',
},
{
src: 'node_modules/jszip/dist/jszip.min.js',
dest: 'dist/development/scripts/jszip.min.js'
},
{
expand: true,
cwd: 'src/assets/logo-dev',
src: ['**'],
dest: 'dist/development/assets/logo/',
}
]
}
},
jshint: {
all: ['Gruntfile.js', 'src/**/*.js']
},
"uglify":{
production: {
options: {
compress: true,
beautify: true
},
files: [
{ src:["src/scripts/background.js"], dest:"dist/production/scripts/background.js" },
{ src:["src/scripts/content.js"], dest:"dist/production/scripts/content.js" },
{ src:["src/scripts/copyright.js"], dest:"dist/production/scripts/copyright.js" },
{ src:["src/scripts/easyReadTools.js"], dest:"dist/production/scripts/easyReadTools.js" },
{ src:["src/records/allRecords.js"], dest:"dist/production/records/allRecords.js" },
{ src:["src/popup/popup.js"], dest:"dist/production/popup/popup.js" },
{ src:["src/setting/setting.js"], dest:"dist/production/setting/setting.js" },
{ src:["src/debug/testStorage.js"], dest:"dist/production/debug/testStorage.js" },
]
}
},
"crx": {
production: {
files: [
{
src: "dist/production/**/*",
dest: "output/chrome-extensions-<%= pkg.name %>-<%= manifest.version %>-prod.zip",
},
{
src: "dist/production/**/*",
dest: "output/chrome-extensions-<%= pkg.name %>-<%= manifest.version %>-prod.crx",
options: {
privateKey: 'key.pem'
}
}
]
},
development: {
files: [
{
src: "dist/development/**/*",
dest: "output/chrome-extensions-<%= pkg.name %>-<%= manifest.version %>-dev.zip",
},
{
src: "dist/development/**/*",
dest: "output/chrome-extensions-<%= pkg.name %>-<%= manifest.version %>-dev.crx",
options: {
privateKey: 'key.pem'
}
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-crx-new');
grunt.registerTask('default', ['clean', 'copy', 'uglify', 'crx']);
grunt.registerTask('do-jshint', ['jshint']);
grunt.registerTask('export-crx', ['crx']);
};