mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Tools: Added build tools detection script (#2661)
* finished writing first script version * added preinstall script * removed white space and platform if statements * remove error log * removed install function * corrected commands * changed ls to list
This commit is contained in:
parent
7640839f92
commit
62665899c6
27
build_tools_check.js
Normal file
27
build_tools_check.js
Normal file
@ -0,0 +1,27 @@
|
||||
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');
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"description": "Joplin root package for linting",
|
||||
"scripts": {
|
||||
"preinstall": "node build_tools_check.js",
|
||||
"linter": "./node_modules/.bin/eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx",
|
||||
"linter-ci": "./node_modules/.bin/eslint --ext .js --ext .jsx --ext .ts --ext .tsx",
|
||||
"watch": "gulp watch",
|
||||
|
Loading…
Reference in New Issue
Block a user