Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/create-excalibur. A repo bootstrapping tool to get you started making your first games!
Something went wrong. Try again.
1.6 kB · 70 lines
JavaScript
at hub-list
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071import { alert, log, printLine, textBlue, textGray, textMagenta, textWhite,} from "./console.js";import { execSync } from "child_process";import * as fs from "fs";
export function printDocs() { const LINK_DOCS = "https://excaliburjs.com/docs/"; log(`${textGray("Explore our Docs:")} ${textBlue(LINK_DOCS)}`);}export function printDiscord() { const LINK_DISCORD = "https://discord.com/invite/W6zUd4tTY3"; log(`${textGray("Join our Discord:")} ${textMagenta(LINK_DISCORD)}`);}export function printSupport() { log(textWhite("If you find yourself stuck:")); printDiscord(); printDocs(); printLine();}
export function runCommand(command) { try { execSync(`${command}`, { stdio: "inherit" }); } catch (e) { return false; } return true;}export function readFile(path, encoding = "utf-8") { return fs.readFileSync(path, encoding);}export function readDirectory(path) { return fs.readdirSync(path);}export function getResourceStats(path) { return fs.statSync(path);}export function writeFile(path, content, encoding = "utf-8") { fs.writeFileSync(path, content, encoding);}export function removeFile(path) { try { fs.unlinkSync(path); } catch (err) { console.error(err.message); }}export function removeFolder(path) { try { fs.rmSync(path, { recursive: true, force: true }); } catch (err) { console.error(err.message); }}export function slugify(str) { str = str.replace(/^\s+|\s+$/g, ""); str = str.toLowerCase(); str = str .replace(/[^a-z0-9 -]/g, "") .replace(/\s+/g, "-") .replace(/-+/g, "-"); return str;}