-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
88 lines (77 loc) · 2.9 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
/*!
Copyright 2018-2024 Brummolix (new version AutoarchiveReloaded, https://github.com/Brummolix/AutoarchiveReloaded )
This file is part of AutoarchiveReloaded.
AutoarchiveReloaded is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AutoarchiveReloaded is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AutoarchiveReloaded. If not, see <http://www.gnu.org/licenses/>.
*/
//this is no typescript file!
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
// eslint-disable-next-line @typescript-eslint/no-var-requires
const webpackConfig = require("./webpack.config.js");
module.exports = (grunt) => {
const srcDir = "src/";
const outDir = "dist/";
const outDirExtracted = outDir + "/release/";
const outXpi = outDir + "/AutoArchiveReloaded.xpi";
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
clean: [outDir],
copy: {
main: {
files: [
{ expand: true, cwd: "resources/", src: ["**"], dest: outDirExtracted },
{ expand: true, cwd: srcDir + "/backgroundScript/", src: ["**", "!**/*.ts", "!**/tsconfig*.json"], dest: outDirExtracted },
{ expand: true, cwd: srcDir + "/options/", src: ["**", "!**/*.ts", "!**/tsconfig*.json"], dest: outDirExtracted },
{ expand: true, cwd: srcDir + "/popup/", src: ["**", "!**/*.ts", "!**/tsconfig*.json"], dest: outDirExtracted },
{ expand: true, src: ["./licence.txt", "./README.md"], dest: outDirExtracted },
],
},
},
mochaTest: {
test: {
options: {
reporter: "spec",
},
src: ["./dist/test.js"],
},
},
webpack: {
myConfig: webpackConfig,
},
// make a zipfile
compress: {
main: {
options: {
archive: outXpi,
mode: "zip",
},
files: [
{ expand: true, cwd: outDirExtracted, src: ["**"], dest: "/" }, // makes all src relative to cwd
],
},
},
eslint: {
target: [srcDir + "/**/*.ts", srcDir + "/**/*.js", "!src/**/libs/**/*.js"],
},
});
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-webpack");
grunt.loadNpmTasks("grunt-eslint");
grunt.loadNpmTasks("grunt-mocha-test");
//tasks
grunt.registerTask("default", ["clean", "copy", "webpack", "compress", "mochaTest", "eslint"]);
};