Skip to content

Commit

Permalink
feat(*): bump all versions feature
Browse files Browse the repository at this point in the history
  • Loading branch information
eser committed Jul 16, 2024
1 parent d2740e6 commit 94e96db
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/bump-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const DEFAULT_RANGE_REQUIRED = [

export function defaultParseCommitMessage(
commit: Commit,
workspaceModules: WorkspaceModule[],
): VersionBump[] | Diagnostic {
const match = RE_DEFAULT_PATTERN.exec(commit.subject);
if (match === null) {
Expand All @@ -148,7 +149,11 @@ export function defaultParseCommitMessage(
};
}
const [, tag, module, _message] = match;
const modules = module ? module.split(/\s*,\s*/) : [];
const modules = module === "*"
? workspaceModules.map((x) => x.name)
: module
? module.split(/\s*,\s*/)
: [];
if (modules.length === 0) {
if (DEFAULT_RANGE_REQUIRED.includes(tag)) {
return {
Expand Down Expand Up @@ -526,7 +531,10 @@ export type BumpWorkspaceOptions = {
start?: string;
/** The base branch name to compare commits. The default is the current branch. */
base?: string;
parseCommitMessage?: (commit: Commit) => VersionBump[] | Diagnostic;
parseCommitMessage?: (
commit: Commit,
workspaceModules: WorkspaceModule[],
) => VersionBump[] | Diagnostic;
/** The root directory of the workspace. */
root?: string;
/** The git user name which is used for making a commit */
Expand Down Expand Up @@ -624,7 +632,7 @@ export async function bumpWorkspaces(
// Skip if the commit subject is release
continue;
}
const parsed = parseCommitMessage(commit);
const parsed = parseCommitMessage(commit, modules);
if (Array.isArray(parsed)) {
for (const versionBump of parsed) {
const diagnostic = checkModuleName(versionBump, modules);
Expand Down

0 comments on commit 94e96db

Please sign in to comment.