-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGruntfile.js
200 lines (177 loc) · 12.6 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/* jshint esversion: 6 */
/// <binding BeforeBuild='default' />
module.exports = function (grunt) {
const sass = require('sass');
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
debug: {
src: ["dist/*"]
},
release: {
src: ["dist/*", "Publish"]
}
},
sass: {
options: {
implementation: sass,
sourceMap: false, // Create source map
outputStyle: 'expanded' // Minify output
},
chromium_dist: {
files: [{
expand: true, // Recursive
cwd: "src/content/sass", // The startup directory
src: ["*.scss"], // Source files
dest: "dist/chromium/content/css", // Destination
ext: ".css", // File extension
}]
},
firefox_dist: {
files: [{
expand: true, // Recursive
cwd: "src/content/sass", // The startup directory
src: ["*.scss"], // Source files
dest: "dist/firefox/content/css", // Destination
ext: ".css", // File extension
}]
}
},
copy: {
// release: {
// files: [
// // js
// { expand: true, flatten: true, src: 'node_modules/@fortawesome/fontawesome-free/js/all.min.js', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/js/bootstrap4-toggle.min.js', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/bootstrap-slider.min.js', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/jquery/dist/jquery.min.js', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map', dest: 'dist/content/js', filter: 'isFile' },
// { expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist', filter: 'isFile' },
// // css
// { expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css', dest: 'dist/content/css', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css.map', dest: 'dist/content/css', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css', dest: 'dist/content/css', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css.map', dest: 'dist/content/css', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css', dest: 'dist/content/css', filter: 'isFile' },
// { expand: true, flatten: true, src: 'node_modules/@melloware/coloris/dist/coloris.min.css', dest: 'dist/content/css', filter: 'isFile' },
// //{ expand: true, flatten: false, cwd: "src", src: '**/*.css', dest: 'dist', filter: 'isFile' },
// // content
// { expand: true, flatten: true, src: 'src/*.html', dest: 'dist', filter: 'isFile' },
// // images
// { expand: true, flatten: false, cwd: "src/content/assets/images/", src: '**', dest: 'dist/content/assets/images' }
// ]
// },
firefox: {
files: [
// js
{ expand: true, flatten: true, src: 'node_modules/@fortawesome/fontawesome-free/js/all.min.js', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/js/bootstrap4-toggle.min.js', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/bootstrap-slider.min.js', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/jquery/dist/jquery.min.js', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map', dest: 'dist/firefox/content/js', filter: 'isFile' },
{ expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist/firefox', filter: 'isFile' },
// css
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css', dest: 'dist/firefox/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css.map', dest: 'dist/firefox/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css', dest: 'dist/firefox/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css.map', dest: 'dist/firefox/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css', dest: 'dist/firefox/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/@melloware/coloris/dist/coloris.min.css', dest: 'dist/firefox/content/css', filter: 'isFile' },
//{ expand: true, flatten: false, cwd: "src", src: '**/*.css', dest: 'dist', filter: 'isFile' },
// content
{ expand: true, flatten: true, src: 'src/*.html', dest: 'dist/firefox', filter: 'isFile' },
// images
{ expand: true, flatten: false, cwd: "src/content/assets/images/", src: '**', dest: 'dist/firefox/content/assets/images' },
// manifest
{ expand: true, flatten: true, src: 'src/manifest-firefox/manifest.json', dest: 'dist/firefox', filter: 'isFile' }
]
},
chromium: {
files: [
// js
{ expand: true, flatten: true, src: 'node_modules/@fortawesome/fontawesome-free/js/all.min.js', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/js/bootstrap4-toggle.min.js', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/bootstrap-slider.min.js', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/jquery/dist/jquery.min.js', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map', dest: 'dist/chromium/content/js', filter: 'isFile' },
{ expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist/chromium', filter: 'isFile' },
// css
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css', dest: 'dist/chromium/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap/dist/css/bootstrap.min.css.map', dest: 'dist/chromium/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css', dest: 'dist/chromium/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap4-toggle/css/bootstrap4-toggle.min.css.map', dest: 'dist/chromium/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css', dest: 'dist/chromium/content/css', filter: 'isFile' },
{ expand: true, flatten: true, src: 'node_modules/@melloware/coloris/dist/coloris.min.css', dest: 'dist/chromium/content/css', filter: 'isFile' },
//{ expand: true, flatten: false, cwd: "src", src: '**/*.css', dest: 'dist', filter: 'isFile' },
// content
{ expand: true, flatten: true, src: 'src/*.html', dest: 'dist/chromium', filter: 'isFile' },
// images
{ expand: true, flatten: false, cwd: "src/content/assets/images/", src: '**', dest: 'dist/chromium/content/assets/images' },
// manifest
{ expand: true, flatten: true, src: 'src/manifest-chromium/manifest.json', dest: 'dist/chromium', filter: 'isFile' }
]
},
debug: {
files: [
// debug
{ expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist/chromium', filter: 'isFile' },
{ expand: true, flatten: false, cwd: "src", src: '**/*.js', dest: 'dist/firefox', filter: 'isFile' }
]
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: ['Gruntfile.js', 'src/content/**/*.js']
},
watch: {
debug: {
files: [
'Gruntfile.js',
'src/**/*.*'
],
tasks: ['release'],
options: {
spawn: false,
},
}
},
shell: {
ps: {
options: {
stdout: true
},
command: 'powershell.exe -File CreatePackage_Grunt.ps1'
},
sh: {
options: {
stdout: true
},
command: './create_package_Grunt.sh'
}
}
});
// debug group task
grunt.registerTask('debug', ['jshint', 'clean:debug', 'sass', 'copy']);
grunt.registerTask('playwright', ['clean:debug', 'sass', 'copy:firefox', 'copy:chromium']);
if (process.platform === "win32") {
// release group task
grunt.registerTask('release', ['jshint', 'clean:release', 'sass', 'copy:firefox', 'copy:chromium', 'shell:ps']);
} else {
// Runs the .sh package create. Possibly.
grunt.registerTask('release', ['jshint', 'clean:release', 'sass', 'copy:firefox', 'copy:chromium', 'shell:sh']);
}
// review group task
grunt.registerTask('review', ['clean:release', 'copy:release']);
};