1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 13:07:58 +00:00

build.js recreates build output dir after it has been removed (fixes #62)

This commit is contained in:
Romein van Buren 2023-07-21 19:28:41 +02:00
parent 3827ae3482
commit 24b3180eb5
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
2 changed files with 27 additions and 3 deletions

View File

@ -5,6 +5,7 @@
* Find view: paste ID and press Enter (#55). * Find view: paste ID and press Enter (#55).
* Preserve state after switching to another tab (#56). * Preserve state after switching to another tab (#56).
* Find view: ask for confirmation before negligently deleting documents when the user has clicked the '-' button (#58). * Find view: ask for confirmation before negligently deleting documents when the user has clicked the '-' button (#58).
* Build script recreates the build output directory after it has been removed (#62).
## [v0.2.2] ## [v0.2.2]

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
const { execSync, spawn } = require('child_process'); const { execSync, spawn } = require('child_process');
const { readFileSync, statSync, rmdirSync } = require('fs'); const { readFileSync, statSync, rmdirSync, mkdirSync } = require('fs');
// Check that the script is run from the root. // Check that the script is run from the root.
@ -145,6 +145,12 @@ if (missingDependencies.length > 0) {
console.log('Cleaning output directory...'); console.log('Cleaning output directory...');
try { rmdirSync('./build/bin'); } catch {} try { rmdirSync('./build/bin'); } catch {}
try {
mkdirSync('./build/bin');
}
catch (err) {
console.log('Failed to create build output directory!');
}
// Build Rolens. // Build Rolens.
@ -154,8 +160,25 @@ console.log();
const proc = spawn('wails', [ 'build', '-clean', isWindows ? '-nsis' : '' ]); const proc = spawn('wails', [ 'build', '-clean', isWindows ? '-nsis' : '' ]);
if (!quiet) { if (!quiet) {
proc.stdout.on('data', data => process.stdout.write(data)); const suppressMessages = [
'Wails CLI',
'If Wails is useful',
'https://github.com/sponsors/leaanthony',
];
proc.stdout.on('data', data => {
for (let i = 0; i < suppressMessages.length; i++) {
if (data.toString().indexOf(suppressMessages[i]) !== -1) {
return;
}
}
process.stdout.write(data);
});
proc.stderr.on('data', data => process.stderr.write(data)); proc.stderr.on('data', data => process.stderr.write(data));
} }
proc.on('exit', code => process.exit(code)); proc.on('exit', code => {
console.log();
process.exit(code);
});