binary-installer
Advanced tools
Comparing version 0.0.2 to 0.0.3
17
index.js
@@ -66,3 +66,7 @@ const { existsSync, mkdirSync, rmSync } = require('fs'); | ||
} | ||
install(fetchOptions, suppressLogs = false) { | ||
install(fetchOptions, options) { | ||
const { allowReinstall, suppressLogs } = options || { | ||
allowReinstall: true, | ||
suppressLogs: false | ||
}; | ||
const { url } = this; | ||
@@ -78,5 +82,12 @@ if (!url) { | ||
if (existsSync(this.installDirectory)) { | ||
rmrf(this.installDirectory); | ||
if (this.exists()) { | ||
if (allowReinstall) { | ||
console.log(`\n${this.name} is already installed, reinstalling...`); | ||
this.uninstall(); | ||
} else { | ||
console.log(`\n${this.name} is already installed, skipping...`); | ||
return; | ||
} | ||
} | ||
mkdirSync(this.installDirectory, { recursive: true }); | ||
@@ -83,0 +94,0 @@ if (!suppressLogs) { |
{ | ||
"name": "binary-installer", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:bytemain/binary-installer.git", |
4969
123