"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const commandsAndFlags = require("./lib/commandsAndFlags.cjs"); const createDebugger = require("./lib/createDebugger.cjs"); const hasFlag = require("./lib/hasFlag.cjs"); const pkg = require("./lib/pkg.cjs"); const debugCLI = createDebugger.createDebugger("akte:cli"); const exit = (code) => { debugCLI("done"); process.exit(code); }; const displayHelp = () => { debugCLI.log(` Akte CLI DOCUMENTATION https://akte.js.org VERSION ${pkg.pkg.name}@${pkg.pkg.version} USAGE $ node akte.app.js $ npx tsx akte.app.ts COMMANDS build Build Akte to file system OPTIONS --silent, -s Silence output --help, -h Display CLI help --version, -v Display CLI version `); exit(0); }; const displayVersion = () => { debugCLI.log(`${pkg.pkg.name}@${pkg.pkg.version}`); exit(0); }; const build = async (app) => { debugCLI.log("\nAkte → Beginning build...\n"); await app.buildAll(); const buildTime = `${Math.ceil(performance.now())}ms`; debugCLI.log("\nAkte → Done in %o", buildTime); return exit(0); }; const runCLI = async (app) => { debugCLI("started"); process.title = "Akte CLI"; if (hasFlag.hasHelp()) { debugCLI("displaying help"); return displayHelp(); } else if (hasFlag.hasVersion()) { debugCLI("displaying version"); return displayVersion(); } const [command] = commandsAndFlags.commandsAndFlags(); switch (command) { case "build": debugCLI("running %o command", command); return build(app); default: debugCLI.log(`Akte → Unknown command \`${command}\`, use \`--help\` flag for manual`); exit(2); } }; exports.runCLI = runCLI; //# sourceMappingURL=runCLI.cjs.map