-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgruntfile.js
65 lines (59 loc) · 1.97 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
module.exports = function (grunt) {
grunt.initConfig({
eslint: {
lint_electron: {
src: ["src/main.ts", "src/preload.ts"],
options: { maxWarnings: 0 },
},
},
exec: {
compile_react: {
command: "\"node_modules/.bin/react-scripts\" build",
options: {
env: Object.assign({}, process.env, { CI: "true" }), // treat warnings as errors
},
},
compile_electron: {
command: "node ./node_modules/typescript/bin/tsc src/main.ts src/preload.ts --esModuleInterop --outDir build"
},
},
copy: {
toBuild: {
files: [
{ expand: true, cwd: "src", src: ["package.json"], dest: "build/" }
]
},
toScr: {
files: [{
expand: true,
src: "package/photo-screen-saver-win32-x64/photo-screen-saver.exe",
rename: function () { return "package/photo-screen-saver-win32-x64/photo-screen-saver.scr" }
}]
}
},
electron: {
default: {
options: {
name: "photo-screen-saver",
dir: "build",
out: "package",
platform: "win32",
arch: "x64",
overwrite: true
}
}
},
clean: {
options: { "no-write": false },
folders: ["build/", "package/"],
}
})
grunt.loadNpmTasks("grunt-contrib-clean")
grunt.loadNpmTasks("grunt-contrib-copy")
grunt.loadNpmTasks("grunt-electron")
grunt.loadNpmTasks("grunt-eslint")
grunt.loadNpmTasks("grunt-exec")
grunt.registerTask("build", ["exec:compile_react", "exec:compile_electron", "eslint:lint_electron", "copy:toBuild"])
grunt.registerTask("package", ["electron", "copy:toScr"])
grunt.registerTask("default", ["build", "package"])
}