forked from Chia-Network/chia-blockchain-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestoreMessages.js
28 lines (24 loc) · 895 Bytes
/
restoreMessages.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
const { exec } = require('child_process');
const os = require('os');
// Clean up messages.po and messages.js files autogenerated by the build process
if (os.platform() === 'win32') {
const command =
"git status -s | Select-String -Pattern 'M .+messages\\.(po|js)' | ForEach-Object { $_.ToString().Split(' ')[-1] } | ForEach-Object { git restore $_ }";
const powerShellCmd = `PowerShell.exe -ExecutionPolicy Bypass -Command "& {${command}}"`;
exec(powerShellCmd, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(stdout);
});
} else {
const command = 'git status -s | grep -E "M .+messages\\.(po|js)" | cut -d " " -f 3 | xargs git restore';
exec(command, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(stdout);
});
}