Skip to main content
Module

x/darkflare/cli/mod.ts

The API Engine
Go to Latest
File
import { parse } from 'https://deno.land/std@0.167.0/flags/mod.ts'import { buildCommand } from './build/command.ts'import { getVersion } from './getVersion.ts'import log from './log.ts'import { bold, strikethrough } from 'https://deno.land/std@0.170.0/fmt/colors.ts'import { deployCommand } from './deploy/command.ts'
const cli = async () => { const args = parse(Deno.args)
const { currentVersion, latestVersion } = await getVersion()
if (currentVersion !== latestVersion) { await log.warn(`${strikethrough(currentVersion)} » ${bold(latestVersion)} 🥳 🎉\n\n`, '\n\n🎉 🥳 update available') } else { try { if (args._[0] === 'build') await buildCommand(currentVersion) else if (args._[0] === 'deploy') await deployCommand(args)
Deno.exit() } catch (err) { if (err instanceof Error) await log.error(err.message)
Deno.exit(1) } }}
if (import.meta.main) cli()