@modyqyw/fabric
Version:
Opinionated shareable specifications for git-based JavaScript/TypeScript projects.
51 lines (46 loc) • 1.23 kB
JavaScript
;
const env = require('./fabric.B2dPjHjl.cjs');
function parseOptions(options = {}) {
const { style = "conventional" } = options;
let { monorepo = true } = options;
if (monorepo === true) {
monorepo = env.hasPnpmWorkspace ? "pnpm-workspace" : env.hasLerna ? "lerna" : env.hasNx ? "nx" : env.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
};
}
exports.commitlint = commitlint;
exports.parseOptions = parseOptions;