forked from coreybutler/nvm-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
36 lines (31 loc) · 904 Bytes
/
build.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
const content = await Deno.readTextFile('./nvm.iss')
const data = JSON.parse(await Deno.readTextFile('./src/manifest.json'))
const {version} = data
const output = content.replaceAll('{{VERSION}}', version)
await Deno.writeTextFile('./.tmp.iss', output)
const command = await new Deno.Command('.\\assets\\buildtools\\iscc.exe', {
args: ['.\\.tmp.iss'],
stdout: 'piped',
stderr: 'piped',
})
const process = command.spawn();
// Stream stdout
(async () => {
const decoder = new TextDecoder();
for await (const chunk of process.stdout) {
console.log(decoder.decode(chunk));
}
})();
// Stream stderr
(async () => {
const decoder = new TextDecoder();
for await (const chunk of process.stderr) {
console.error(decoder.decode(chunk));
}
})();
// Wait for completion
const status = await process.status;
Deno.remove('.\\.tmp.iss');
if (!status.success) {
Deno.exit(status.code);
}