now checking if tool already installed

This commit is contained in:
2016-11-25 22:34:28 +01:00
parent 9822a9c867
commit 77a4cd7a12
5 changed files with 20 additions and 9 deletions

View File

@@ -28,8 +28,14 @@ export let install = (versionArg) => {
configModule.getConfig()
.then(config => {
for (let npmTool of config.globalNpmTools) {
plugins.beautylog.info(`globally installing ${npmTool} from npm`)
bash(`npm install -q -g ${npmTool}`)
let whichOutput = bash(`which ${npmTool}`)
let toolAvailable: boolean = !(/not found/.test(whichOutput))
if (toolAvailable) {
plugins.beautylog.log(`Tool ${npmTool} is available`)
} else {
plugins.beautylog.info(`globally installing ${npmTool} from npm`)
bash(`npm install -q -g ${npmTool}`)
}
}
done.resolve()
})