-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9e2aeb
commit 6863618
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// This is a deno helper script to locally build the installer using Inno Setup | ||
// Yeah, I know it's not Node, but we need to compile this and Node SEAs on Win32 are a PITA. | ||
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) | ||
|
||
console.log('Viewing /.tmp.iss') | ||
output.split("\n").forEach((line, num) => { | ||
let n = `${num+1}` | ||
while (n.length < 3) { | ||
n = ' ' + n | ||
} | ||
|
||
console.log(`${n} | ${line}`) | ||
}) | ||
|
||
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); | ||
} |