feat: new page UI + db fixes + installer improvements

This commit is contained in:
Nicolas Giard
2018-08-19 01:22:59 -04:00
parent 04c972c1d0
commit 4bb522f9d9
21 changed files with 357 additions and 182 deletions

View File

@@ -3,15 +3,14 @@ package main
import (
"fmt"
"log"
"os"
"os/exec"
"github.com/blang/semver"
"github.com/fatih/color"
"github.com/pbnjay/memory"
"github.com/ttacon/chalk"
)
const nodejsSemverRange = ">=8.11.3 <10.0.0"
const nodejsSemverRange = ">=8.11.4 <11.0.0"
const ramMin = 768
// CheckNodeJs checks if Node.js is installed and has minimal supported version
@@ -25,11 +24,10 @@ func CheckNodeJs() bool {
validRange := semver.MustParseRange(nodejsSemverRange)
nodeVersion, err := semver.ParseTolerant(string(cmdOutput[:]))
if !validRange(nodeVersion) {
fmt.Printf(chalk.Red.Color("Error: Installed Node.js version is not supported! %s"), nodejsSemverRange)
os.Exit(1)
panic(fmt.Errorf(color.RedString("Error: Installed Node.js version %s is not supported! %s\n"), nodeVersion, nodejsSemverRange))
}
fmt.Printf(chalk.Green.Color("✔")+" Node.js %s: OK\n", nodeVersion.String())
fmt.Printf(color.GreenString("✔")+" Node.js %s: OK\n", nodeVersion.String())
return true
}
@@ -38,11 +36,10 @@ func CheckNodeJs() bool {
func CheckRAM() bool {
var totalRAM = memory.TotalMemory() / 1024 / 1024
if totalRAM < ramMin {
fmt.Printf(chalk.Red.Color("Error: System does not meet RAM requirements. %s MB minimum."), ramMin)
os.Exit(1)
panic(fmt.Errorf(color.RedString("Error: System does not meet RAM requirements. %s MB minimum.\n"), ramMin))
}
fmt.Printf(chalk.Green.Color("✔")+" Total System RAM %d MB: OK\n", totalRAM)
fmt.Printf(color.GreenString("✔")+" Total System RAM %d MB: OK\n", totalRAM)
return true
}