UNPKG

@vortex.so/cli

Version:

CLI to interact with Vortex.

40 lines (37 loc) 992 B
import fs from 'fs-extra'; import yaml from 'js-yaml'; import { valid } from 'semver'; async function getInput(operation) { const { name, namespace, handle, kind, type, description, version, build } = yaml.load(fs.readFileSync("vortex.yaml", "utf-8")); if (!name) throw new Error("Missing name."); if (!namespace) throw new Error("Missing namespace."); if (!handle) throw new Error("Missing handle."); if (!description) throw new Error("Missing description."); if (!version) throw new Error("Missing version."); if (build === void 0) throw new Error("Missing build."); if (!valid(version)) { throw new Error("Version is invalid."); } if (typeof build != "number") { throw new TypeError("Build is invalid."); } return operation.update({ name, namespace, handle, description, kind, type, version, oldVersionSource: "vortex.yaml", oldVersion: version, oldBuild: build }); } export { getInput };