UNPKG

vlt

Version:
125 lines (123 loc) 3.61 kB
var global = globalThis; import {Buffer} from "node:buffer"; import {setTimeout,clearTimeout,setImmediate,clearImmediate,setInterval,clearInterval} from "node:timers"; import {createRequire as _vlt_createRequire} from "node:module"; var require = _vlt_createRequire(import.meta.filename); import { loadCommand } from "./chunk-G3BQHLJP.js"; import { Config } from "./chunk-FRVD5QAW.js"; import "./chunk-FZMPFIDM.js"; import "./chunk-SLTPNBLH.js"; import "./chunk-D36DAG56.js"; import "./chunk-LEKM5RQR.js"; import "./chunk-YWPMIBJS.js"; import "./chunk-5UBJ3ZBM.js"; import "./chunk-SGEQHKFC.js"; import { indent, outputCommand, stderr, stdout } from "./chunk-I5CBBY6I.js"; import { asRootError } from "./chunk-VTABR43C.js"; import "./chunk-QAFV2NQX.js"; import { loadPackageJson } from "./chunk-VYJVN3B6.js"; import "./chunk-GADRCS54.js"; import "./chunk-GY4L7O2Y.js"; import "./chunk-3HSZY4YW.js"; import "./chunk-6YRWYWZQ.js"; import "./chunk-TJHWNOOA.js"; import "./chunk-L3TCSQZJ.js"; import "./chunk-3RABDTYN.js"; import "./chunk-264UXZEG.js"; import "./chunk-X4RDKJKD.js"; import { getSortedCliOptions, getSortedKeys } from "./chunk-BNCOU5ZT.js"; import "./chunk-RV3EHS4P.js"; import "./chunk-AECDW3EJ.js"; // ../../src/cli-sdk/src/index.ts import { format } from "node:util"; var { version } = loadPackageJson( import.meta.filename, "cli-package.json" ); var loadVlt = async (cwd, argv) => { try { return await Config.load(cwd, argv); } catch (e) { const err = asRootError(e, { code: "JACKSPEAK" }); const { found, path, wanted, name } = err.cause; const isConfigFile = typeof path === "string"; const msg = isConfigFile ? `Problem in Config File ${path}` : "Invalid Option Flag"; const validOptions = wanted ? void 0 : isConfigFile ? getSortedKeys() : getSortedCliOptions(); stderr(msg); stderr(err.message); if (name) stderr(indent(`Field: ${format(name)}`)); if (found) { stderr( indent( `Found: ${isConfigFile ? JSON.stringify(found) : format(found)}` ) ); } if (wanted) stderr(indent(`Wanted: ${format(wanted)}`)); if (validOptions) { stderr(indent("Valid Options:")); stderr(indent(validOptions.join("\n"), 4)); } stderr( indent( `Run 'vlt help' for more information about available options.` ) ); return process.exit(process.exitCode || 1); } }; var run = async () => { const start = Date.now(); const cwd = process.cwd(); const vlt = await loadVlt(cwd, process.argv); if (vlt.get("version")) { return stdout(version); } const { monorepo } = vlt.options; if (vlt.get("workspace") === void 0) { const ws = monorepo?.get(cwd); if (ws) { vlt.values.workspace = [ws.path]; vlt.options.workspace = [ws.path]; } } if (vlt.command !== "init" && (vlt.get("workspace") || vlt.get("workspace-group")) && ![...monorepo?.values() ?? []].length) { stderr( `Error: No matching workspaces found. Make sure the vlt.json config contains the correct workspaces.` ); if (vlt.get("workspace")) { stderr(indent(`Workspace: ${format(vlt.get("workspace"))}`)); } if (vlt.get("workspace-group")) { stderr( indent( `Workspace Group: ${format(vlt.get("workspace-group"))}` ) ); } return process.exit(process.exitCode || 1); } const command = await loadCommand(vlt.command); await outputCommand(command, vlt, { start }); }; var src_default = run; export { src_default as default }; //# sourceMappingURL=src-3OOHDAN3.js.map