UNPKG

@vortex.so/cli

Version:

CLI to interact with Vortex.

88 lines (85 loc) 2.21 kB
import { defineCommand } from 'citty'; import prompts from 'prompts'; import 'node:process'; import c from 'chalk'; import 'figures'; import 'jiti'; import { Log } from '../../../utils/log/index.mjs'; import { Ship } from '../../../plugins/ship/ship.mjs'; const log = new Log("Ship"); const shipCommand = defineCommand({ meta: { name: "ship", description: c.dim(`Ship 'em up!`) }, args: { command: { type: "positional", alias: "c", description: "Command to run.", required: false } }, async run({ args }) { prompts.override({ command: args.command }); try { const answers = await prompts([ { type: "select", name: "command", message: "What kind of shipment do you want to do?", choices: [ { title: "Version", value: "version", description: "Bump project version." }, { title: "Commit and tag version", value: "version:commit-tag", description: "Commit and tag project version" }, { title: "Commit version", value: "version:commit", description: "Commit project version." }, { title: "Tag version", value: "version:tag", description: "Tag project version." }, { title: "Publish", value: "publish", description: "Publish package to NPM." } ] } ]); switch (answers.command) { case "version": await Ship.version(); break; case "version:commit-tag": await Ship.commitTag(); break; case "version:commit": await Ship.commit(); break; case "version:tag": await Ship.tag(); break; case "publish": await Ship.publish(); break; default: log.abort("Not shipping anything."); break; } } catch (error) { log.fail(error?.message); } } }); export { shipCommand };