forked from JSKitty/scc-web3
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathpostinstall.cjs
More file actions
27 lines (24 loc) · 837 Bytes
/
postinstall.cjs
File metadata and controls
27 lines (24 loc) · 837 Bytes
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
const { execSync } = require('child_process');
// Determine the operating system type
const os = require('os');
const osType = os.platform();
// Define the command to execute based on the OS
let command;
if (osType.match(/aix|darwin|freebsd|linux|openbsd|sunos|android/)) {
command =
'test -f chain_params.json || cp chain_params.prod.json chain_params.json';
} else if (osType.match(/win32/)) {
command =
'if not exist chain_params.json copy chain_params.prod.json chain_params.json';
} else {
console.error('Unsupported operating system');
process.exit(1);
}
// Execute the command
try {
execSync(command, { stdio: 'inherit' });
console.log('Postinstall script executed successfully');
} catch (error) {
console.error('Error executing postinstall script:', error);
process.exit(1);
}