-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
40 lines (25 loc) · 1.11 KB
/
index.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
"use strict";
const fs = require('fs');
const path = require('path');
const util = require('util');
const cp = require('child_process');
const passthru = require('nyks/child_process/passthru');
module.exports = function(root_path, skin, chain){
if(!fs.existsSync(root_path))
chain("wd src_output_dir do not exists");
var pack = require(path.resolve(root_path ,'app', 'package.json'));
var spPath = path.join(path.resolve(__dirname) , 'sp.nsi');
var args = ["/NOCD", "/V4", spPath];
var env = Object.assign({}, process.env);
env.PACKAGE_VERSION = pack.version;
env.PACKAGE_VERSION_CLEAN = "0.0.0.0";
env.PACKAGE_NAME = pack.name;
env.PACKAGE_NAME_WITH_SYMBOL = pack.name;
env.COMPANY_NAME = pack.company;
env.APP_URL = pack.app_url;
env.ROOT_PATH = path.resolve(root_path);
Object.assign(env, skin);
env.OUTFILE = process.env.OUTFILE || util.format("%s/%s-%s-Setup.exe", root_path, pack.name, pack.version);
//generate this BMP 24b with paint (gimp compat mode)
passthru("makensis", {args:args, env: env}, chain);
}