now checking if tool already installed
This commit is contained in:
@ -13,7 +13,7 @@ let checkNvm = () => {
|
||||
}
|
||||
checkNvm()
|
||||
|
||||
export let bash = (commandArg: string, retryArg = 2, bareArg = false) => {
|
||||
export let bash = (commandArg: string, retryArg = 2, bareArg = false): string => {
|
||||
let exitCode: number
|
||||
let stdOut: string
|
||||
let execResult
|
||||
|
@ -8,7 +8,6 @@ export interface INpmciOptions {
|
||||
}
|
||||
|
||||
export let getConfig = () => {
|
||||
console.log('getting config')
|
||||
let done = q.defer<INpmciOptions>()
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let defaultConfig: INpmciOptions = {
|
||||
|
@ -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()
|
||||
})
|
||||
|
Reference in New Issue
Block a user