-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
120 lines (109 loc) · 3.47 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
/*!
Copyright 2018-2020 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 + "/AutoArchiver2.xpi";
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
clean: [outDir],
copy: {
main: {
files: [
{
expand: true,
cwd: "resources/",
src: ["**", "./manifest.json"],
dest: outDirExtracted,
},
{
expand: true,
cwd: srcDir + "/background/",
src: ["**", "!**/*.ts", "!**/tsconfig*.json"],
dest: outDirExtracted,
},
{
expand: true,
cwd: srcDir + "/options/",
src: ["**", "!**/*.ts", "!**/tsconfig*.json"],
dest: outDirExtracted,
},
// { expand: true, cwd: srcDir + "/webexperiment/", 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 + "/**/*.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",
]);
};