forked from laurent22/joplin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tools_check.js
27 lines (24 loc) · 1.12 KB
/
build_tools_check.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
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const verifyBuildToolInstallation = async (tool, checkCommand, installCommand) => {
try {
const { stdout } = await exec(checkCommand);
console.log(`${tool} is Installed: ${stdout}`);
} catch (error) {
console.warn(`WARNING: This development tool is not installed: "${tool}". Please install it using your package manager. For example: ${installCommand}`);
}
};
switch (process.platform) {
case 'win32':
verifyBuildToolInstallation('Windows Build Tools', 'npm list -g windows-build-tools', 'npm install --global windows-build-tools');
break;
case 'darwin':
verifyBuildToolInstallation('CocoaPods', 'pod --version', 'sudo gem install cocoapods');
verifyBuildToolInstallation('rsync', 'rsync --version', 'sudo port install rsync');
break;
case 'linux':
verifyBuildToolInstallation('rsync', 'rsync --version', 'sudo apt-get install rsync');
break;
default:
console.log('WARNING: Please ensure that you read the documentation to know the necessary build tools that must be installed in your system to successfullly build this project');
}