UNPKG

@modyqyw/fabric

Version:

Opinionated shareable specifications for git-based JavaScript/TypeScript projects.

48 lines (44 loc) 1.23 kB
import { N as hasPnpmWorkspace, K as hasLerna, L as hasNx, M as hasRush } from './fabric.UWmAURsN.mjs'; function parseOptions(options = {}) { const { style = "conventional" } = options; let { monorepo = true } = options; if (monorepo === true) { monorepo = hasPnpmWorkspace ? "pnpm-workspace" : hasLerna ? "lerna" : hasNx ? "nx" : hasRush ? "rush" : false; } return { monorepo, style }; } function commitlint(options = {}, userConfig = {}) { const { monorepo, style } = parseOptions(options); const extends_ = []; if (style === "conventional") { extends_.push("@commitlint/config-conventional"); } else if (style === "angular") { extends_.push("@commitlint/config-angular"); } switch (monorepo) { case "lerna": { extends_.push("@commitlint/config-lerna-scopes"); break; } case "nx": { extends_.push("@commitlint/config-nx-scopes"); break; } case "pnpm-workspace": { extends_.push("@commitlint/config-pnpm-scopes"); break; } case "rush": { extends_.push("@commitlint/config-rush-scopes"); break; } } return { extends: extends_, ...userConfig }; } export { commitlint as c, parseOptions as p };