fancy
This commit is contained in:
parent
5fff0e77b8
commit
ffd4e6e4a1
|
|
@ -4,7 +4,7 @@ import { prettyJSON } from "hono/pretty-json"
|
|||
import color from "kleur"
|
||||
|
||||
import { NOSE_ICON, NOSE_DIR, NOSE_BIN, NOSE_WWW } from "./config"
|
||||
import { transpile, isFile } from "./utils"
|
||||
import { transpile, isFile, tilde } from "./utils"
|
||||
import { apps, serveApp } from "./webapp"
|
||||
|
||||
import { Layout } from "./components/layout"
|
||||
|
|
@ -102,9 +102,9 @@ if (process.env.BUN_HOT) {
|
|||
//
|
||||
|
||||
console.log(color.cyan(NOSE_ICON))
|
||||
console.log(color.blue("NOSE_DIR:"), color.yellow(NOSE_DIR.replace(`/Users/${process.env.USER}/`, "~/")))
|
||||
console.log(color.blue("NOSE_BIN:"), color.yellow(NOSE_BIN.replace(`/Users/${process.env.USER}/`, "~/")))
|
||||
console.log(color.blue("NOSE_WWW:"), color.yellow(NOSE_WWW.replace(`/Users/${process.env.USER}/`, "~/")))
|
||||
console.log(color.blue("NOSE_DIR:"), color.yellow(tilde(NOSE_DIR)))
|
||||
console.log(color.blue("NOSE_BIN:"), color.yellow(tilde(NOSE_BIN)))
|
||||
console.log(color.blue("NOSE_WWW:"), color.yellow(tilde(NOSE_WWW)))
|
||||
|
||||
export default {
|
||||
port: process.env.PORT || 3000,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ export function isDir(path: string): boolean {
|
|||
}
|
||||
}
|
||||
|
||||
// Convert /Users/$USER or /home/$USER to ~ for simplicity
|
||||
export function tilde(path: string): string {
|
||||
return path.replace(new RegExp(`/(Users|home)/${process.env.USER}`), "~")
|
||||
}
|
||||
|
||||
// Generate a random 8 character string
|
||||
export function randomID(): string {
|
||||
return Math.random().toString(36).slice(2, 10)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user