@storm-software/git-tools
Version:
Tools for managing Git repositories within a Nx workspace.
229 lines (227 loc) • 6.5 kB
JavaScript
// src/types.ts
var DEFAULT_COMMIT_TYPES = {
/* --- Bumps version when selected --- */
chore: {
description: "Other changes that don't modify src or test files",
title: "Chore",
emoji: "\u2699\uFE0F ",
semverBump: "patch",
changelog: {
title: "Miscellaneous",
hidden: false
}
},
fix: {
description: "A change that resolves an issue previously identified with the package",
title: "Bug Fix",
emoji: "\u{1FAB2} ",
semverBump: "patch",
changelog: {
title: "Bug Fixes",
hidden: false
}
},
feat: {
description: "A change that adds a new feature to the package",
title: "Feature",
emoji: "\u{1F511} ",
semverBump: "minor",
changelog: {
title: "Features",
hidden: false
}
},
ci: {
description: "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)",
title: "Continuous Integration",
emoji: "\u{1F9F0} ",
semverBump: "patch",
changelog: {
title: "Continuous Integration",
hidden: false
}
},
refactor: {
description: "A code change that neither fixes a bug nor adds a feature",
title: "Code Refactoring",
emoji: "\u{1F9EA} ",
semverBump: "patch",
changelog: {
title: "Source Code Improvements",
hidden: false
}
},
style: {
description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
title: "Style Improvements",
emoji: "\u{1F48E} ",
semverBump: "patch",
changelog: {
title: "Style Improvements",
hidden: false
}
},
perf: {
description: "A code change that improves performance",
title: "Performance Improvement",
emoji: "\u23F1\uFE0F ",
semverBump: "patch",
changelog: {
title: "Performance Improvements",
hidden: false
}
},
/* --- Does not bump version when selected --- */
docs: {
description: "A change that only includes documentation updates",
title: "Documentation",
emoji: "\u{1F4DC} ",
semverBump: "none",
changelog: {
title: "Documentation",
hidden: false
}
},
test: {
description: "Adding missing tests or correcting existing tests",
title: "Testing",
emoji: "\u{1F6A8} ",
semverBump: "none",
changelog: {
title: "Testing",
hidden: true
}
},
/* --- Not included in commitlint but included in changelog --- */
deps: {
description: "Changes that add, update, or remove dependencies. This includes devDependencies and peerDependencies",
title: "Dependencies",
emoji: "\u{1F4E6} ",
hidden: true,
semverBump: "patch",
changelog: {
title: "Dependency Upgrades",
hidden: false
}
},
/* --- Not included in commitlint or changelog --- */
build: {
description: "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)",
title: "Build",
emoji: "\u{1F6E0} ",
hidden: true,
semverBump: "none",
changelog: {
title: "Build",
hidden: true
}
},
release: {
description: "Publishing a commit containing a newly released version",
title: "Publish Release",
emoji: "\u{1F680} ",
hidden: true,
semverBump: "none",
changelog: {
title: "Publish Release",
hidden: true
}
}
};
var DEFAULT_COMMIT_QUESTIONS = {
type: {
type: "select",
title: "Commit Type",
description: "Select the commit type that best describes your changes",
enum: Object.keys(DEFAULT_COMMIT_TYPES).filter(
(type) => DEFAULT_COMMIT_TYPES[type].hidden !== true
).reduce((ret, type) => {
ret[type] = DEFAULT_COMMIT_TYPES[type];
return ret;
}, {}),
defaultValue: "chore",
maxLength: 20,
minLength: 3
},
scope: {
type: "select",
title: "Commit Scope",
description: "Select the monorepo project that is primarily impacted by this change",
enum: {},
defaultValue: "monorepo",
maxLength: 50,
minLength: 1
},
subject: {
type: "input",
title: "Commit Subject",
description: "Write a short, imperative tense description of the change",
maxLength: 150,
minLength: 3
},
body: {
type: "input",
title: "Commit Body",
description: "Provide a longer description of the change",
maxLength: 600
},
isBreaking: {
type: "confirm",
title: "Breaking Changes",
description: "Are there any breaking changes as a result of this commit?",
defaultValue: false
},
breakingBody: {
type: "input",
title: "Breaking Changes (Details)",
description: "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
when: (answers) => answers.isBreaking === true,
maxLength: 600,
minLength: 3
},
isIssueAffected: {
type: "confirm",
title: "Open Issue Affected",
description: "Does this change impact any open issues?",
defaultValue: false
},
issuesBody: {
type: "input",
title: "Open Issue Affected (Details)",
description: "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
when: (answers) => answers.isIssueAffected === true,
maxLength: 600,
minLength: 3
}
};
var DEFAULT_COMMIT_PROMPT_MESSAGES = {
skip: "press enter to skip",
max: "must be %d chars at most",
min: "must be %d chars at least",
emptyWarning: "can not be empty",
upperLimitWarning: "%s is %d characters longer than the upper limit",
lowerLimitWarning: "%s is %d characters less than the lower limit",
closedIssueMessage: "Closes: "
};
var DEFAULT_COMMIT_MESSAGE_FORMAT = "{type}({scope}): {emoji}{subject}";
var DEFAULT_COMMIT_SETTINGS = {
enableMultipleScopes: false,
disableEmoji: true,
breakingChangePrefix: "\u{1F4A3} ",
closedIssuePrefix: "\u2705 ",
format: DEFAULT_COMMIT_MESSAGE_FORMAT
};
var RuleConfigSeverity = /* @__PURE__ */ ((RuleConfigSeverity2) => {
RuleConfigSeverity2[RuleConfigSeverity2["Disabled"] = 0] = "Disabled";
RuleConfigSeverity2[RuleConfigSeverity2["Warning"] = 1] = "Warning";
RuleConfigSeverity2[RuleConfigSeverity2["Error"] = 2] = "Error";
return RuleConfigSeverity2;
})(RuleConfigSeverity || {});
export {
DEFAULT_COMMIT_TYPES,
DEFAULT_COMMIT_QUESTIONS,
DEFAULT_COMMIT_PROMPT_MESSAGES,
DEFAULT_COMMIT_MESSAGE_FORMAT,
DEFAULT_COMMIT_SETTINGS,
RuleConfigSeverity
};