You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

58 lines
1.3 KiB

const { say } = require("cfonts")
const chalk = require("chalk")
export function logStats(proc, data) {
let log = ""
log += chalk.yellow.bold(`${proc} Process ${new Array(19 - proc.length + 1).join("-")}`)
log += "\n\n"
if (typeof data === "object") {
data
.toString({
colors: true,
chunks: false,
})
.split(/\r?\n/)
.forEach(line => {
log += " " + line + "\n"
})
} else {
log += ` ${data}\n`
}
log += "\n" + chalk.yellow.bold(`${new Array(28 + 1).join("-")}`) + "\n"
console.log(log)
}
export function electronLog(data, color) {
let log = ""
data = data.toString().split(/\r?\n/)
data.forEach(line => {
log += ` ${line}\n`
})
if (/[0-9A-z]+/.test(log)) {
console.log(
chalk[color].bold("┏ Electron -------------------") + "\n\n" + log + chalk[color].bold("┗ ----------------------------") + "\n"
)
}
}
export function greeting() {
const cols = process.stdout.columns
let text
if (cols > 104) text = "electron-vue"
else if (cols > 76) text = "electron-|vue"
else text = false
if (text) {
say(text, {
colors: ["yellow"],
font: "simple3d",
space: false,
})
} else console.log(chalk.yellow.bold("\n electron-vue"))
console.log(chalk.blue(" getting ready...") + "\n")
}