lerna
Version:
Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository
29 lines (26 loc) • 765 B
JavaScript
import {
exec,
npmlog_default
} from "./chunk-WC2B4V4E.js";
// libs/commands/publish/src/lib/get-current-tags.ts
import npa from "npm-package-arg";
async function getCurrentTags(execOpts, matchingPattern) {
npmlog_default.silly("getCurrentTags", "matching %j", matchingPattern);
const opts = Object.assign({}, execOpts, {
// don't reject due to non-zero exit code when there are no results
reject: false
});
const result = await exec(
"git",
["tag", "--sort", "version:refname", "--points-at", "HEAD", "--list", matchingPattern],
opts
);
const lines = result.stdout.split("\n").filter(Boolean);
if (matchingPattern === "*@*") {
return lines.map((tag) => npa(tag).name);
}
return lines;
}
export {
getCurrentTags
};