-
Notifications
You must be signed in to change notification settings - Fork 3
/
make-wrapper.coffee
57 lines (51 loc) · 1.38 KB
/
make-wrapper.coffee
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
path = require "path"
nexe = require "nexe"
zip = require "zip-folder"
winresourcer =
try
require "nw-builder/node_modules/winresourcer"
catch
require "winresourcer"
change_exe_subsystem = require "./subsystem"
app_folder = "app"
app_exe = "nw-screensaver.scr"
zip_file = "app.zip"
win_ico = "#{app_folder}/img/icon.ico"
console.log "Zip", app_folder, "to", zip_file
zip app_folder, zip_file, (err)->
throw err if err
console.log "Compile ./wrapper.js to #{app_exe} with nexe"
nexe.compile
input: "./wrapper.js"
output: app_exe
nodeVersion: "0.12.6"
framework: "nodejs"
nodeTempDir: "temp"
python: process.env.PYTHON or "python"
flags: true
resourceFiles: [zip_file]
(err)->
throw err if err
console.log "Delete the Node.js icon from #{app_exe}"
winresourcer
operation: "Delete"
exeFile: path.resolve app_exe
resourceFile: path.resolve win_ico
resourceType: "Icon"
resourceName: 1
lang: 1033
(err)->
throw err if err
console.log "Add the new icon to #{app_exe}"
winresourcer
operation: "Add"
exeFile: path.resolve app_exe
resourceFile: path.resolve win_ico
resourceType: "Icon"
resourceName: 1
lang: 1033
(err)->
throw err if err
console.log "Make the exe into a GUI app so it doesn't show the console"
change_exe_subsystem app_exe, "GUI"
console.log "Done!"