This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
forked from evshiron/nwjs-builder-phoenix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
nsis-gen.js
73 lines (51 loc) · 1.51 KB
/
nsis-gen.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
import { test } from 'ava';
import { writeFileAsync, removeAsync } from 'fs-extra-promise';
import { NsisComposer, NsisDiffer, nsisBuild } from '../dist/lib/nsis-gen';
import { tmpName, tmpFile, tmpDir } from '../dist/lib/util';
const options = {
// Basic.
appName: 'Project',
companyName: 'evshiron',
description: 'description',
version: '0.1.0.0',
copyright: 'copyright',
// Compression.
compression: 'lzma',
solid: true,
modern: true,
languages: [ 'English' ],
// FIXME: TradChinese is missing and SimpChinese becomes the default language, what happens?
//languages: [ 'English', 'SimpChinese', 'TradChinese' ],
};
test('build', async (t) => {
const output = await tmpName({
postfix: '.exe',
});
const data = await (new NsisComposer(Object.assign({}, options, {
output,
})))
.make();
const script = await tmpName({
postfix: '.nsi',
});
await writeFileAsync(script, data);
await nsisBuild('./src/', script);
await removeAsync(output);
await removeAsync(script);
});
test('diff', async (t) => {
const output = await tmpName({
postfix: '.exe',
});
const data = await (new NsisDiffer('./src/', './dist/', Object.assign({}, options, {
output,
})))
.make();
const script = await tmpName({
postfix: '.nsi',
});
await writeFileAsync(script, data);
await nsisBuild('./dist/', script);
await removeAsync(output);
await removeAsync(script);
});