UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

31 lines (27 loc) 654 B
/*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ import { getGitTags } from "./chunk-EGPL7C6E.mjs"; import "./chunk-OEREUEGT.mjs"; import "./chunk-UFOKMNUE.mjs"; import { findLastIndex } from "./chunk-R4AZFFAM.mjs"; import "./chunk-NYLAFCGV.mjs"; // src/getAppVersion.ts async function getAppVersion(pkgName) { const tags = await getGitTags(); const tag = findLastIndex(tags, (tag2) => tag2.startsWith(pkgName)); if (tag === -1) { throw new Error("Your app(s) doesnt have any tag"); } const version = tags[tag].split("@")[1]; return version; } export { getAppVersion };