UNPKG

@vortex.so/cli

Version:

CLI to interact with Vortex.

31 lines (28 loc) 769 B
import { readFileSync } from 'node:fs'; import { z } from '@neon.id/z'; import c from 'chalk'; import yaml from 'js-yaml'; import { ManifestSchema } from './manifest.schemas.mjs'; import { Log } from '../../utils/log/index.mjs'; const log = new Log("Manifest"); class Manifest { static get() { const manifest = yaml.load( readFileSync("vortex.yaml", "utf-8") ); return manifest; } static validate(manifest) { const validation = z.validate(ManifestSchema, manifest, { wrap: (label) => c.bold(label) }); if (validation.status === "success") { return validation.data; } else { Object.values(validation.messages).flat().forEach((message) => { log.fail(message); }); } } } export { Manifest };