@mui/internal-code-infra 0.0.3-canary.81 → 0.0.3-canary.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/changelog/buildSections.d.mts +19 -0
- package/build/changelog/categorizeCommits.d.mts +18 -0
- package/build/{utils/changelog.d.mts → changelog/fetchChangelogs.d.mts} +2 -22
- package/build/changelog/filterCommits.d.mts +14 -0
- package/build/changelog/generateChangelog.d.mts +15 -0
- package/build/changelog/index.d.mts +3 -0
- package/build/changelog/loadChangelogConfig.d.mts +13 -0
- package/build/changelog/parseCommitLabels.d.mts +13 -0
- package/build/changelog/renderChangelog.d.mts +32 -0
- package/build/changelog/sortSections.d.mts +16 -0
- package/build/changelog/types.d.ts +390 -0
- package/build/cli/cmdGenerateChangelog.d.mts +24 -0
- package/build/utils/babel.d.mts +0 -5
- package/build/utils/git.d.mts +2 -1
- package/build/utils/pnpm.d.mts +4 -0
- package/build/utils/template.d.mts +19 -0
- package/package.json +7 -6
- package/src/changelog/buildSections.mjs +334 -0
- package/src/changelog/categorizeCommits.mjs +160 -0
- package/src/changelog/categorizeCommits.test.ts +319 -0
- package/src/{utils/changelog.mjs → changelog/fetchChangelogs.mjs} +6 -14
- package/src/changelog/filterCommits.mjs +57 -0
- package/src/changelog/filterCommits.test.ts +363 -0
- package/src/changelog/generateChangelog.mjs +63 -0
- package/src/changelog/index.mjs +7 -0
- package/src/changelog/loadChangelogConfig.mjs +99 -0
- package/src/changelog/parseCommitLabels.mjs +78 -0
- package/src/changelog/parseCommitLabels.test.ts +509 -0
- package/src/changelog/renderChangelog.mjs +539 -0
- package/src/changelog/renderChangelog.test.ts +378 -0
- package/src/changelog/sortSections.mjs +30 -0
- package/src/changelog/sortSections.test.ts +199 -0
- package/src/changelog/types.ts +438 -0
- package/src/cli/cmdGenerateChangelog.mjs +69 -0
- package/src/cli/index.mjs +2 -0
- package/src/utils/babel.mjs +0 -1
- package/src/utils/extractErrorCodes.mjs +34 -24
- package/src/utils/git.mjs +3 -2
- package/src/utils/pnpm.mjs +4 -1
- package/src/utils/template.mjs +23 -0
- package/src/utils/template.test.mjs +133 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').CategorizedCommit} CategorizedCommit
|
|
3
|
+
* @typedef {import('./types.ts').ChangelogSection} ChangelogSection
|
|
4
|
+
* @typedef {import('./types.ts').CategorizationConfig} CategorizationConfig
|
|
5
|
+
* @typedef {import('./types.ts').PlanInheritanceConfig} PlanInheritanceConfig
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Builds ordered changelog sections from categorized commits.
|
|
9
|
+
*
|
|
10
|
+
* @param {Map<string, CategorizedCommit[]>} categorizedCommits - Map of category key to commits
|
|
11
|
+
* @param {CategorizationConfig} categorizationConfig - Categorization configuration
|
|
12
|
+
* @param {Map<string, string>} [packageVersions] - Map of package name to version
|
|
13
|
+
* @returns {ChangelogSection[]} Ordered sections
|
|
14
|
+
*/
|
|
15
|
+
export function buildSections(categorizedCommits: Map<string, CategorizedCommit[]>, categorizationConfig: CategorizationConfig, packageVersions?: Map<string, string>): ChangelogSection[];
|
|
16
|
+
export type CategorizedCommit = import("./types.ts").CategorizedCommit;
|
|
17
|
+
export type ChangelogSection = import("./types.ts").ChangelogSection;
|
|
18
|
+
export type CategorizationConfig = import("./types.ts").CategorizationConfig;
|
|
19
|
+
export type PlanInheritanceConfig = import("./types.ts").PlanInheritanceConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').FetchedCommitDetails} FetchedCommitDetails
|
|
3
|
+
* @typedef {import('./types.ts').CategorizedCommit} CategorizedCommit
|
|
4
|
+
* @typedef {import('./types.ts').CategorizationConfig} CategorizationConfig
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Categorizes commits based on the configuration strategy.
|
|
8
|
+
* A commit with multiple scope/component labels will appear in multiple sections.
|
|
9
|
+
*
|
|
10
|
+
* @param {FetchedCommitDetails[]} commits - Commits to categorize
|
|
11
|
+
* @param {CategorizationConfig} config - Categorization configuration
|
|
12
|
+
* @returns {Map<string, CategorizedCommit[]>} Map of category key to commits
|
|
13
|
+
* @throws {Error} If a required label is missing or package mapping not found
|
|
14
|
+
*/
|
|
15
|
+
export function categorizeCommits(commits: FetchedCommitDetails[], config: CategorizationConfig): Map<string, CategorizedCommit[]>;
|
|
16
|
+
export type FetchedCommitDetails = import("./types.ts").FetchedCommitDetails;
|
|
17
|
+
export type CategorizedCommit = import("./types.ts").CategorizedCommit;
|
|
18
|
+
export type CategorizationConfig = import("./types.ts").CategorizationConfig;
|
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
* @typedef {import('@octokit/rest').Octokit} OctokitType
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* @typedef {'
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {Object} FetchedCommitDetails
|
|
9
|
-
* @property {string} sha
|
|
10
|
-
* @property {string} message
|
|
11
|
-
* @property {string[]} labels
|
|
12
|
-
* @property {number} prNumber
|
|
13
|
-
* @property {string} html_url
|
|
14
|
-
* @property {{login: string; association: AuthorAssociation} | null} author
|
|
5
|
+
* @typedef {import('./types').FetchedCommitDetails} FetchedCommitDetails
|
|
15
6
|
*/
|
|
16
7
|
/**
|
|
17
8
|
* @typedef {Object} FetchCommitsOptions
|
|
@@ -41,18 +32,7 @@ export function fetchCommitsBetweenRefs(opts: FetchCommitsOptions & {
|
|
|
41
32
|
octokit?: OctokitType;
|
|
42
33
|
}): Promise<FetchedCommitDetails[]>;
|
|
43
34
|
export type OctokitType = import("@octokit/rest").Octokit;
|
|
44
|
-
export type
|
|
45
|
-
export type FetchedCommitDetails = {
|
|
46
|
-
sha: string;
|
|
47
|
-
message: string;
|
|
48
|
-
labels: string[];
|
|
49
|
-
prNumber: number;
|
|
50
|
-
html_url: string;
|
|
51
|
-
author: {
|
|
52
|
-
login: string;
|
|
53
|
-
association: AuthorAssociation;
|
|
54
|
-
} | null;
|
|
55
|
-
};
|
|
35
|
+
export type FetchedCommitDetails = import("./types").FetchedCommitDetails;
|
|
56
36
|
export type FetchCommitsOptions = {
|
|
57
37
|
repo: string;
|
|
58
38
|
lastRelease: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').FetchedCommitDetails} FetchedCommitDetails
|
|
3
|
+
* @typedef {import('./types.ts').FilterConfig} FilterConfig
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Filters commits based on the configuration.
|
|
7
|
+
*
|
|
8
|
+
* @param {FetchedCommitDetails[]} commits - Commits to filter
|
|
9
|
+
* @param {FilterConfig} [filterConfig] - Filter configuration
|
|
10
|
+
* @returns {FetchedCommitDetails[]} Filtered commits
|
|
11
|
+
*/
|
|
12
|
+
export function filterCommits(commits: FetchedCommitDetails[], filterConfig?: FilterConfig): FetchedCommitDetails[];
|
|
13
|
+
export type FetchedCommitDetails = import("./types.ts").FetchedCommitDetails;
|
|
14
|
+
export type FilterConfig = import("./types.ts").FilterConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').GenerateChangelogOptions} GenerateChangelogOptions
|
|
3
|
+
* @typedef {import('./types.ts').GenerateChangelogResult} GenerateChangelogResult
|
|
4
|
+
* @typedef {import('./types.ts').ChangelogConfig} ChangelogConfig
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generates a changelog for a release.
|
|
8
|
+
*
|
|
9
|
+
* @param {GenerateChangelogOptions} options - Options for generating the changelog
|
|
10
|
+
* @returns {Promise<GenerateChangelogResult>} Changelog result with markdown and sections
|
|
11
|
+
*/
|
|
12
|
+
export function generateChangelog(options: GenerateChangelogOptions): Promise<GenerateChangelogResult>;
|
|
13
|
+
export type GenerateChangelogOptions = import("./types.ts").GenerateChangelogOptions;
|
|
14
|
+
export type GenerateChangelogResult = import("./types.ts").GenerateChangelogResult;
|
|
15
|
+
export type ChangelogConfig = import("./types.ts").ChangelogConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').ChangelogConfig} ChangelogConfig
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Loads changelog configuration from a file.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} configPath - Path to config file (relative or absolute)
|
|
8
|
+
* @param {string} [cwd] - Current working directory
|
|
9
|
+
* @returns {Promise<ChangelogConfig>} Loaded configuration
|
|
10
|
+
* @throws {Error} If config file doesn't exist or is invalid
|
|
11
|
+
*/
|
|
12
|
+
export function loadChangelogConfig(configPath: string, cwd?: string): Promise<ChangelogConfig>;
|
|
13
|
+
export type ChangelogConfig = import("./types.ts").ChangelogConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses labels from a commit and extracts scopes, components, plan, category overrides, and flags.
|
|
3
|
+
* Supports multiple scope and component labels - the commit will appear in all matching sections.
|
|
4
|
+
* Mutates the commit's labels to include any extracted from the title.
|
|
5
|
+
*
|
|
6
|
+
* @param {FetchedCommitDetails} commit - The commit to parse labels from
|
|
7
|
+
* @param {LabelConfig} labelConfig - Configuration for label parsing
|
|
8
|
+
* @returns {ParsedLabels} Parsed label information
|
|
9
|
+
*/
|
|
10
|
+
export function parseCommitLabels(commit: FetchedCommitDetails, labelConfig: LabelConfig): ParsedLabels;
|
|
11
|
+
export type FetchedCommitDetails = import("./types.ts").FetchedCommitDetails;
|
|
12
|
+
export type ParsedLabels = import("./types.ts").ParsedLabels;
|
|
13
|
+
export type LabelConfig = import("./types.ts").LabelConfig;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats changelog sections into markdown.
|
|
3
|
+
*
|
|
4
|
+
* @param {ChangelogSection[]} sections - Changelog sections
|
|
5
|
+
* @param {ChangelogConfig} config - Changelog configuration
|
|
6
|
+
* @param {import('./types.js').GenerateChangelogOptions} options - Generate changelog options
|
|
7
|
+
* @param {{team: string[], community: string[], all: string[]}} contributors - Contributors
|
|
8
|
+
* @returns {string} Formatted changelog markdown
|
|
9
|
+
*/
|
|
10
|
+
export function renderChangelog(sections: ChangelogSection[], config: ChangelogConfig, options: import("./types.js").GenerateChangelogOptions, contributors: {
|
|
11
|
+
team: string[];
|
|
12
|
+
community: string[];
|
|
13
|
+
all: string[];
|
|
14
|
+
}): string;
|
|
15
|
+
/**
|
|
16
|
+
* Extracts contributors from all commits, excluding only those matching excludeAuthors.
|
|
17
|
+
* This is used to credit all contributors, even if their commits were filtered out
|
|
18
|
+
* for other reasons (like missing labels or being in excludeLabels).
|
|
19
|
+
*
|
|
20
|
+
* @param {import('./types.js').FetchedCommitDetails[]} allCommits - All fetched commits
|
|
21
|
+
* @param {(string|RegExp)[]} [excludeAuthors] - Author patterns to exclude (e.g., ['[bot]'])
|
|
22
|
+
* @returns {{team: string[], community: string[]; all: string[]}} Contributors grouped by type
|
|
23
|
+
*/
|
|
24
|
+
export function extractContributorsFromAllCommits(allCommits: import("./types.js").FetchedCommitDetails[], excludeAuthors?: (string | RegExp)[]): {
|
|
25
|
+
team: string[];
|
|
26
|
+
community: string[];
|
|
27
|
+
all: string[];
|
|
28
|
+
};
|
|
29
|
+
export type ChangelogSection = import("./types.js").ChangelogSection;
|
|
30
|
+
export type CategorizedCommit = import("./types.js").CategorizedCommit;
|
|
31
|
+
export type ChangelogConfig = import("./types.js").ChangelogConfig;
|
|
32
|
+
export type GenerateChangelogResult = import("./types.js").GenerateChangelogResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./types.ts').ChangelogSection} ChangelogSection
|
|
3
|
+
* @typedef {import('./types.ts').CategorizationConfig} CategorizationConfig
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Sorts changelog sections based on configured order priority.
|
|
7
|
+
* Sections with lower order index appear first.
|
|
8
|
+
* When two sections have the same order index, they are sorted alphabetically by title.
|
|
9
|
+
*
|
|
10
|
+
* @param {ChangelogSection[]} sections - Sections to sort
|
|
11
|
+
* @param {CategorizationConfig} config - Categorization configuration containing order
|
|
12
|
+
* @returns {ChangelogSection[]} Sorted sections
|
|
13
|
+
*/
|
|
14
|
+
export function sortSections(sections: ChangelogSection[], config: CategorizationConfig): ChangelogSection[];
|
|
15
|
+
export type ChangelogSection = import("./types.ts").ChangelogSection;
|
|
16
|
+
export type CategorizationConfig = import("./types.ts").CategorizationConfig;
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commit details fetched from GitHub including PR information and labels.
|
|
3
|
+
*/
|
|
4
|
+
export interface FetchedCommitDetails {
|
|
5
|
+
sha: string;
|
|
6
|
+
message: string;
|
|
7
|
+
labels: string[];
|
|
8
|
+
prNumber: number;
|
|
9
|
+
html_url: string;
|
|
10
|
+
author: {
|
|
11
|
+
login: string;
|
|
12
|
+
association: 'team' | 'first_timer' | 'contributor';
|
|
13
|
+
} | null;
|
|
14
|
+
mergedAt: string | null;
|
|
15
|
+
createdAt: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parsed label information from a commit.
|
|
19
|
+
*/
|
|
20
|
+
export interface ParsedLabels {
|
|
21
|
+
/**
|
|
22
|
+
* Scope values from labels (e.g., from 'scope: data-grid', 'scope: charts').
|
|
23
|
+
* Multiple scopes mean the commit should appear in multiple sections.
|
|
24
|
+
*/
|
|
25
|
+
scopes: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Component values from labels (e.g., from 'component: checkbox', 'component: radio').
|
|
28
|
+
* Multiple components mean the commit should appear in multiple sections.
|
|
29
|
+
*/
|
|
30
|
+
components: string[];
|
|
31
|
+
plan?: string;
|
|
32
|
+
flags: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Category override from a label (e.g., 'all components' -> 'General changes').
|
|
35
|
+
* This overrides the normal categorization logic.
|
|
36
|
+
*/
|
|
37
|
+
categoryOverride?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A commit with parsed label information.
|
|
41
|
+
*/
|
|
42
|
+
export interface CategorizedCommit extends FetchedCommitDetails {
|
|
43
|
+
parsed: ParsedLabels;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Configuration for label parsing.
|
|
47
|
+
*/
|
|
48
|
+
export interface LabelConfig {
|
|
49
|
+
plan: {
|
|
50
|
+
values: string[];
|
|
51
|
+
};
|
|
52
|
+
scope?: {
|
|
53
|
+
prefix: string[];
|
|
54
|
+
};
|
|
55
|
+
component?: {
|
|
56
|
+
prefix: string[];
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Category overrides - labels that override normal categorization.
|
|
60
|
+
* Maps label to section name.
|
|
61
|
+
* Example: { 'all components': 'General changes', 'docs': 'Docs' }
|
|
62
|
+
*/
|
|
63
|
+
categoryOverrides?: Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* Explicit list of flag labels.
|
|
66
|
+
* Only labels in this list will be treated as flags.
|
|
67
|
+
* Example: ['breaking change', 'enhancement', 'bug']
|
|
68
|
+
*/
|
|
69
|
+
flags?: Record<string, {
|
|
70
|
+
name: string;
|
|
71
|
+
prefix?: string;
|
|
72
|
+
suffix?: string;
|
|
73
|
+
}>;
|
|
74
|
+
extractLabelsFromTitle?: (commitMessage: string) => string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Package naming configuration for package-first strategy.
|
|
78
|
+
*/
|
|
79
|
+
export interface PackageNamingConfig {
|
|
80
|
+
/**
|
|
81
|
+
* Explicit mapping from scope label value to package name.
|
|
82
|
+
* Example: { 'data grid': '@mui/x-data-grid', 'charts': '@mui/x-charts' }
|
|
83
|
+
*/
|
|
84
|
+
mappings: Record<string, string>;
|
|
85
|
+
/**
|
|
86
|
+
* Mappings for different plan variants.
|
|
87
|
+
* Maps plan name to a mapping of base package to plan-specific package.
|
|
88
|
+
* Example: {
|
|
89
|
+
* 'pro': { '@mui/x-charts': '@mui/x-charts-pro' },
|
|
90
|
+
* 'premium': { '@mui/x-charts': '@mui/x-charts-premium' },
|
|
91
|
+
* 'enterprise': { '@mui/x-charts': '@mui/x-charts-enterprise' }
|
|
92
|
+
* }
|
|
93
|
+
*/
|
|
94
|
+
plans?: Record<string, Record<string, string>>;
|
|
95
|
+
/**
|
|
96
|
+
* Scope values that represent generic sections (not packages).
|
|
97
|
+
* These scopes won't go through package name resolution and will be used as-is for sections.
|
|
98
|
+
* Example: ['docs', 'code-infra', 'docs-infra']
|
|
99
|
+
*/
|
|
100
|
+
genericScopes?: string[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Configuration for categorizing commits into sections.
|
|
104
|
+
*/
|
|
105
|
+
export interface CategorizationConfig {
|
|
106
|
+
/**
|
|
107
|
+
* Primary categorization strategy.
|
|
108
|
+
* - 'component': Group by component name (For new repos with 1 or 2 packages)
|
|
109
|
+
* - 'package': Group by package name (For established repos with multiple packages)
|
|
110
|
+
*/
|
|
111
|
+
strategy: 'component' | 'package';
|
|
112
|
+
/**
|
|
113
|
+
* Label configuration for parsing commit labels.
|
|
114
|
+
*/
|
|
115
|
+
labels: LabelConfig;
|
|
116
|
+
/**
|
|
117
|
+
* Package naming configuration (required for 'package' strategy).
|
|
118
|
+
*/
|
|
119
|
+
packageNaming?: PackageNamingConfig;
|
|
120
|
+
/**
|
|
121
|
+
* Section ordering and titles.
|
|
122
|
+
*/
|
|
123
|
+
sections: {
|
|
124
|
+
/**
|
|
125
|
+
* Section ordering priority by title.
|
|
126
|
+
* Maps section title to order index (lower values appear first).
|
|
127
|
+
* Sections not in this map default to order index 0.
|
|
128
|
+
* When two sections have the same order index, they are sorted alphabetically by title.
|
|
129
|
+
*/
|
|
130
|
+
order?: Record<string, number>;
|
|
131
|
+
/**
|
|
132
|
+
* Optional custom titles for sections.
|
|
133
|
+
* Maps section key to display title.
|
|
134
|
+
*/
|
|
135
|
+
titles?: Record<string, string>;
|
|
136
|
+
/**
|
|
137
|
+
* Section name for commits that don't match any category.
|
|
138
|
+
*/
|
|
139
|
+
fallbackSection: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Optional mapping from component label value to display name.
|
|
143
|
+
* Example: { 'pie': 'PieChart', 'bar': 'BarChart' }
|
|
144
|
+
*/
|
|
145
|
+
componentNameMapping?: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Configuration for plan inheritance (pro/premium packages).
|
|
149
|
+
*/
|
|
150
|
+
export interface PlanInheritanceConfig {
|
|
151
|
+
enabled: boolean;
|
|
152
|
+
messages: {
|
|
153
|
+
same: string;
|
|
154
|
+
plus: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Configuration for version and date formatting.
|
|
159
|
+
*/
|
|
160
|
+
export interface FormatConfig {
|
|
161
|
+
/**
|
|
162
|
+
* Version format template.
|
|
163
|
+
* Use {{version}} placeholder, the value will be picked from workspace package.json.
|
|
164
|
+
*
|
|
165
|
+
* @default 'v{{version}}'
|
|
166
|
+
* @example `Release v{{version}}`
|
|
167
|
+
*/
|
|
168
|
+
version?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Date format (using common format tokens). Only the four tokens below are supported:
|
|
171
|
+
* - MMM: abbreviated month name (e.g., Jan, Feb, Mar)
|
|
172
|
+
* - MMMM: full month name (e.g., January, February)
|
|
173
|
+
* - DD: day of month (01 to 31)
|
|
174
|
+
* - YYYY: four-digit year (e.g., 2025)
|
|
175
|
+
*
|
|
176
|
+
* @default 'MMM DD, YYYY' (e.g., 'Aug 15 2025')
|
|
177
|
+
*/
|
|
178
|
+
dateFormat?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Format for PR and author attribution. Available placeholders:
|
|
181
|
+
* - {{message}}: Commit message (cleaned up first line)
|
|
182
|
+
* - {{rawMessage}}: Raw commit message (without cleanup and only the first line)
|
|
183
|
+
* - {{prNumber}}: Pull request number
|
|
184
|
+
* - {{prUrl}}: Pull request URL
|
|
185
|
+
* - {{author}}: Author username
|
|
186
|
+
* - {{scope}}: Scope value
|
|
187
|
+
* - {{plan}}: Plan value
|
|
188
|
+
*
|
|
189
|
+
* @example '{{message}} (#[{{prNumber}}]({{prUrl}}) by @{{author}})'
|
|
190
|
+
*/
|
|
191
|
+
changelogMessage?: string | ((commit: CategorizedCommit) => string);
|
|
192
|
+
sectionTitle?: {
|
|
193
|
+
forPackage?: string;
|
|
194
|
+
};
|
|
195
|
+
planMessage?: {
|
|
196
|
+
same: string;
|
|
197
|
+
plus: string;
|
|
198
|
+
};
|
|
199
|
+
planBadge?: Record<string, string>;
|
|
200
|
+
showInternalChangesMessage?: boolean;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Configuration for intro section.
|
|
204
|
+
* The intro section appears after the version and date, before the changelog sections.
|
|
205
|
+
* It can include a thank you message and/or a highlights section with a placeholder for manual curation.
|
|
206
|
+
*/
|
|
207
|
+
export interface IntroConfig {
|
|
208
|
+
/**
|
|
209
|
+
* Thank you message to show at the start of the intro section.
|
|
210
|
+
* Supports placeholders:
|
|
211
|
+
* - {{contributorCount}}: Total number of contributors (team + community)
|
|
212
|
+
* - {{teamCount}}: Number of team members
|
|
213
|
+
* - {{communityCount}}: Number of community contributors
|
|
214
|
+
*
|
|
215
|
+
* Example: "We'd like to extend a big thank you to the {{contributorCount}} contributors who made this release possible"
|
|
216
|
+
*
|
|
217
|
+
* Set to `false` or omit to disable the thank you message.
|
|
218
|
+
*/
|
|
219
|
+
thanksMessage?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Optional prefix text for the highlights section.
|
|
222
|
+
* When provided, adds a highlights section with placeholder comments for manual curation.
|
|
223
|
+
*
|
|
224
|
+
* Example: "Here are some highlights ✨:"
|
|
225
|
+
*/
|
|
226
|
+
highlightsPrefix?: string;
|
|
227
|
+
}
|
|
228
|
+
export type PluralizedMessage = string | {
|
|
229
|
+
many: string;
|
|
230
|
+
one: string;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Configuration for contributors section.
|
|
234
|
+
*/
|
|
235
|
+
export interface ContributorsConfig {
|
|
236
|
+
/**
|
|
237
|
+
* Disable the contributors section entirely.
|
|
238
|
+
* @default false
|
|
239
|
+
*/
|
|
240
|
+
disabled?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Custom message template for the contributors section (when splitByType is false).
|
|
243
|
+
* Supports {contributors} placeholder.
|
|
244
|
+
* Example: "All contributors of this release in alphabetical order: {contributors}"
|
|
245
|
+
*/
|
|
246
|
+
message?: {
|
|
247
|
+
contributors?: PluralizedMessage;
|
|
248
|
+
team?: PluralizedMessage;
|
|
249
|
+
community?: PluralizedMessage;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Add contributors list after the intro section instead of at the end.
|
|
253
|
+
* If true, contributors appear immediately after the intro (before changelog sections).
|
|
254
|
+
* If false (default), contributors appear at the end (after all changelog sections).
|
|
255
|
+
*
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
addContributorsToIntro?: boolean;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Configuration for filtering commits.
|
|
262
|
+
*/
|
|
263
|
+
export interface FilterConfig {
|
|
264
|
+
/**
|
|
265
|
+
* Exclude commits where author username matches any of these patterns.
|
|
266
|
+
* Supports string matching and regular expressions.
|
|
267
|
+
* Example: ['[bot]', 'dependabot'] will exclude any author ending with [bot] or named dependabot.
|
|
268
|
+
*/
|
|
269
|
+
excludeCommitByAuthors?: (RegExp | string)[];
|
|
270
|
+
/**
|
|
271
|
+
* Exclude these authors from being shown in the intro thank you message.
|
|
272
|
+
* Supports string matching and regular expressions.
|
|
273
|
+
*/
|
|
274
|
+
excludeAuthorsFromContributors?: (RegExp | string)[];
|
|
275
|
+
/**
|
|
276
|
+
* Exclude commits that have any of these labels.
|
|
277
|
+
* Example: ['skip-changelog', 'internal']
|
|
278
|
+
*/
|
|
279
|
+
excludeCommitWithLabels?: (RegExp | string)[];
|
|
280
|
+
/**
|
|
281
|
+
* Custom filter function for advanced filtering.
|
|
282
|
+
* Return false to exclude a commit from the changelog.
|
|
283
|
+
*/
|
|
284
|
+
customFilter?: (commit: FetchedCommitDetails) => boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Show "Internal changes." for packages where all commits were filtered out.
|
|
287
|
+
* When true, packages with filtered commits will appear in the changelog with "Internal changes." message.
|
|
288
|
+
* When false (default), packages with all commits filtered are omitted entirely.
|
|
289
|
+
*
|
|
290
|
+
* @default false
|
|
291
|
+
*/
|
|
292
|
+
showFilteredPackages?: boolean;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Complete changelog configuration.
|
|
296
|
+
*/
|
|
297
|
+
export interface ChangelogConfig {
|
|
298
|
+
format?: FormatConfig;
|
|
299
|
+
intro?: IntroConfig;
|
|
300
|
+
contributors?: ContributorsConfig;
|
|
301
|
+
categorization: CategorizationConfig;
|
|
302
|
+
filter?: FilterConfig;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* A section in the changelog.
|
|
306
|
+
*/
|
|
307
|
+
export interface ChangelogSection {
|
|
308
|
+
/**
|
|
309
|
+
* Section key (package name or component name).
|
|
310
|
+
*/
|
|
311
|
+
key: string;
|
|
312
|
+
/**
|
|
313
|
+
* Package version (if applicable).
|
|
314
|
+
*/
|
|
315
|
+
pkgInfo: {
|
|
316
|
+
name: string;
|
|
317
|
+
version?: string;
|
|
318
|
+
plan?: string;
|
|
319
|
+
} | null;
|
|
320
|
+
/**
|
|
321
|
+
* Heading level (2 for top-level, 3 for packages, 4 for sub-sections).
|
|
322
|
+
*/
|
|
323
|
+
level: number;
|
|
324
|
+
/**
|
|
325
|
+
* Commits in this section.
|
|
326
|
+
*/
|
|
327
|
+
commits: CategorizedCommit[];
|
|
328
|
+
/**
|
|
329
|
+
* Sub-sections (for package-first with pro/premium).
|
|
330
|
+
*/
|
|
331
|
+
subsections?: ChangelogSection[];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Options for generating a changelog.
|
|
335
|
+
*/
|
|
336
|
+
export interface GenerateChangelogOptions {
|
|
337
|
+
/**
|
|
338
|
+
* Repository name (e.g., 'mui-x').
|
|
339
|
+
*/
|
|
340
|
+
repo: string;
|
|
341
|
+
/**
|
|
342
|
+
* GitHub organization name (default: 'mui').
|
|
343
|
+
*/
|
|
344
|
+
org?: string;
|
|
345
|
+
/**
|
|
346
|
+
* Last release tag or commit ref.
|
|
347
|
+
*/
|
|
348
|
+
lastRelease: string;
|
|
349
|
+
/**
|
|
350
|
+
* Current release tag or commit ref.
|
|
351
|
+
*/
|
|
352
|
+
release: string;
|
|
353
|
+
/**
|
|
354
|
+
* Version string for the changelog (e.g., '8.19.0').
|
|
355
|
+
*/
|
|
356
|
+
version: string;
|
|
357
|
+
/**
|
|
358
|
+
* Release date (will be formatted according to config).
|
|
359
|
+
*/
|
|
360
|
+
date: Date;
|
|
361
|
+
/**
|
|
362
|
+
* Changelog configuration (if not loading from file).
|
|
363
|
+
*/
|
|
364
|
+
config: ChangelogConfig;
|
|
365
|
+
/**
|
|
366
|
+
* Current working directory to run commands in.
|
|
367
|
+
*/
|
|
368
|
+
cwd?: string;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Result of changelog generation.
|
|
372
|
+
*/
|
|
373
|
+
export interface GenerateChangelogResult {
|
|
374
|
+
/**
|
|
375
|
+
* Formatted changelog markdown.
|
|
376
|
+
*/
|
|
377
|
+
markdown: string;
|
|
378
|
+
/**
|
|
379
|
+
* Categorized sections.
|
|
380
|
+
*/
|
|
381
|
+
sections: ChangelogSection[];
|
|
382
|
+
/**
|
|
383
|
+
* All contributors (for contributors section).
|
|
384
|
+
*/
|
|
385
|
+
contributors: {
|
|
386
|
+
team: string[];
|
|
387
|
+
community: string[];
|
|
388
|
+
all: string[];
|
|
389
|
+
};
|
|
390
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const _default: import("yargs").CommandModule<{}, Args>;
|
|
2
|
+
export default _default;
|
|
3
|
+
export type Args = {
|
|
4
|
+
/**
|
|
5
|
+
* Path to the changelog configuration file
|
|
6
|
+
*/
|
|
7
|
+
config: string;
|
|
8
|
+
/**
|
|
9
|
+
* The git reference (tag/commit) of the last release
|
|
10
|
+
*/
|
|
11
|
+
lastRelease: string;
|
|
12
|
+
/**
|
|
13
|
+
* The git reference (tag/commit) of the new release
|
|
14
|
+
*/
|
|
15
|
+
release: string;
|
|
16
|
+
/**
|
|
17
|
+
* The version number for the new release
|
|
18
|
+
*/
|
|
19
|
+
releaseVersion: string;
|
|
20
|
+
/**
|
|
21
|
+
* The current working directory to run the command in
|
|
22
|
+
*/
|
|
23
|
+
cwd: string;
|
|
24
|
+
};
|
package/build/utils/babel.d.mts
CHANGED
|
@@ -17,7 +17,6 @@ export function cjsCopy({ from, to }: {
|
|
|
17
17
|
/**
|
|
18
18
|
* @typedef {Object} ErrorCodeMetadata
|
|
19
19
|
* @property {string} outputPath - The path where the error code file should be written.
|
|
20
|
-
* @property {'annotate' | 'throw' | 'write'} [missingError] - How to handle missing error codes.
|
|
21
20
|
* @property {string} [runtimeModule] - The runtime module to replace the errors with.
|
|
22
21
|
*/
|
|
23
22
|
/**
|
|
@@ -60,10 +59,6 @@ export type ErrorCodeMetadata = {
|
|
|
60
59
|
* - The path where the error code file should be written.
|
|
61
60
|
*/
|
|
62
61
|
outputPath: string;
|
|
63
|
-
/**
|
|
64
|
-
* - How to handle missing error codes.
|
|
65
|
-
*/
|
|
66
|
-
missingError?: "throw" | "annotate" | "write" | undefined;
|
|
67
62
|
/**
|
|
68
63
|
* - The runtime module to replace the errors with.
|
|
69
64
|
*/
|
package/build/utils/git.d.mts
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* Get current repository info from git remote
|
|
9
|
+
* @param {string} [cwd=process.cwd()]
|
|
9
10
|
* @returns {Promise<RepoInfo>} Repository owner and name
|
|
10
11
|
*/
|
|
11
|
-
export function getRepositoryInfo(): Promise<RepoInfo>;
|
|
12
|
+
export function getRepositoryInfo(cwd?: string): Promise<RepoInfo>;
|
|
12
13
|
/**
|
|
13
14
|
* Get current git SHA
|
|
14
15
|
* @returns {Promise<string>} Current git commit SHA
|
package/build/utils/pnpm.d.mts
CHANGED
|
@@ -235,4 +235,8 @@ export type GetWorkspacePackagesOptions = {
|
|
|
235
235
|
* - Whether to filter to only non-published packages. It by default means public packages yet to be published.
|
|
236
236
|
*/
|
|
237
237
|
nonPublishedOnly?: boolean | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* - Current working directory to run pnpm command in
|
|
240
|
+
*/
|
|
241
|
+
cwd?: string | undefined;
|
|
238
242
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple template string replacement utility.
|
|
3
|
+
* Replaces placeholders like {{ key }} with values from an object.
|
|
4
|
+
* Handles spacing variations: {{key}}, {{ key}}, {{ key }} are all treated the same.
|
|
5
|
+
* If a value is undefined, the placeholder is removed from the output.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} template - Template string with placeholders
|
|
8
|
+
* @param {Record<string, any>} values - Object with template values
|
|
9
|
+
* @returns {string} - Rendered string with placeholders replaced
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const result = templateString('Hello {{ name }}, version {{ version }}', { name: 'Alice' });
|
|
13
|
+
* // 'Hello Alice, version ' (version placeholder removed as it's undefined)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const result = templateString('Release {{ version }}', { version: '1.0.0' });
|
|
17
|
+
* // 'Release 1.0.0'
|
|
18
|
+
*/
|
|
19
|
+
export function templateString(template: string, values: Record<string, any>): string;
|