@eui/mcp 1.0.3
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/README.md +846 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +27 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +224 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +171 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +100 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/cache-manager.d.ts +74 -0
- package/dist/loader/cache-manager.d.ts.map +1 -0
- package/dist/loader/cache-manager.js +107 -0
- package/dist/loader/cache-manager.js.map +1 -0
- package/dist/loader/documentation-loader.d.ts +57 -0
- package/dist/loader/documentation-loader.d.ts.map +1 -0
- package/dist/loader/documentation-loader.js +81 -0
- package/dist/loader/documentation-loader.js.map +1 -0
- package/dist/loader/documentation-source.d.ts +37 -0
- package/dist/loader/documentation-source.d.ts.map +1 -0
- package/dist/loader/documentation-source.js +2 -0
- package/dist/loader/documentation-source.js.map +1 -0
- package/dist/loader/errors.d.ts +34 -0
- package/dist/loader/errors.d.ts.map +1 -0
- package/dist/loader/errors.js +65 -0
- package/dist/loader/errors.js.map +1 -0
- package/dist/loader/http-client.d.ts +43 -0
- package/dist/loader/http-client.d.ts.map +1 -0
- package/dist/loader/http-client.js +144 -0
- package/dist/loader/http-client.js.map +1 -0
- package/dist/loader/index.d.ts +6 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/local-documentation-source.d.ts +62 -0
- package/dist/loader/local-documentation-source.d.ts.map +1 -0
- package/dist/loader/local-documentation-source.js +190 -0
- package/dist/loader/local-documentation-source.js.map +1 -0
- package/dist/loader/path-type-detector.d.ts +34 -0
- package/dist/loader/path-type-detector.d.ts.map +1 -0
- package/dist/loader/path-type-detector.js +78 -0
- package/dist/loader/path-type-detector.js.map +1 -0
- package/dist/loader/remote-documentation-source.d.ts +112 -0
- package/dist/loader/remote-documentation-source.d.ts.map +1 -0
- package/dist/loader/remote-documentation-source.js +252 -0
- package/dist/loader/remote-documentation-source.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +211 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +65 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +224 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/publish/index.d.ts +8 -0
- package/dist/publish/index.d.ts.map +1 -0
- package/dist/publish/index.js +8 -0
- package/dist/publish/index.js.map +1 -0
- package/dist/publish/publish-utils.d.ts +74 -0
- package/dist/publish/publish-utils.d.ts.map +1 -0
- package/dist/publish/publish-utils.js +170 -0
- package/dist/publish/publish-utils.js.map +1 -0
- package/dist/query/component-query.d.ts +33 -0
- package/dist/query/component-query.d.ts.map +1 -0
- package/dist/query/component-query.js +63 -0
- package/dist/query/component-query.js.map +1 -0
- package/dist/query/index-builder.d.ts +79 -0
- package/dist/query/index-builder.d.ts.map +1 -0
- package/dist/query/index-builder.js +217 -0
- package/dist/query/index-builder.js.map +1 -0
- package/dist/query/index.d.ts +5 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +6 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/result-formatter.d.ts +108 -0
- package/dist/query/result-formatter.d.ts.map +1 -0
- package/dist/query/result-formatter.js +165 -0
- package/dist/query/result-formatter.js.map +1 -0
- package/dist/query/search-engine.d.ts +54 -0
- package/dist/query/search-engine.d.ts.map +1 -0
- package/dist/query/search-engine.js +178 -0
- package/dist/query/search-engine.js.map +1 -0
- package/dist/test-error.ts +1 -0
- package/dist/tools/get-component-docs.d.ts +43 -0
- package/dist/tools/get-component-docs.d.ts.map +1 -0
- package/dist/tools/get-component-docs.js +55 -0
- package/dist/tools/get-component-docs.js.map +1 -0
- package/dist/tools/get-component-examples.d.ts +45 -0
- package/dist/tools/get-component-examples.d.ts.map +1 -0
- package/dist/tools/get-component-examples.js +56 -0
- package/dist/tools/get-component-examples.js.map +1 -0
- package/dist/tools/get-component-inputs.d.ts +44 -0
- package/dist/tools/get-component-inputs.d.ts.map +1 -0
- package/dist/tools/get-component-inputs.js +55 -0
- package/dist/tools/get-component-inputs.js.map +1 -0
- package/dist/tools/get-component-outputs.d.ts +44 -0
- package/dist/tools/get-component-outputs.d.ts.map +1 -0
- package/dist/tools/get-component-outputs.js +55 -0
- package/dist/tools/get-component-outputs.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-components.d.ts +69 -0
- package/dist/tools/list-components.d.ts.map +1 -0
- package/dist/tools/list-components.js +84 -0
- package/dist/tools/list-components.js.map +1 -0
- package/dist/tools/search-components.d.ts +69 -0
- package/dist/tools/search-components.d.ts.map +1 -0
- package/dist/tools/search-components.js +98 -0
- package/dist/tools/search-components.js.map +1 -0
- package/dist/types/compodoc.d.ts +261 -0
- package/dist/types/compodoc.d.ts.map +1 -0
- package/dist/types/compodoc.js +5 -0
- package/dist/types/compodoc.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +91 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +186 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/credential-masking.d.ts +90 -0
- package/dist/utils/credential-masking.d.ts.map +1 -0
- package/dist/utils/credential-masking.js +202 -0
- package/dist/utils/credential-masking.js.map +1 -0
- package/dist/utils/error-handler.d.ts +68 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +184 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/errors.d.ts +156 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +242 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +76 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +150 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/retry.d.ts +19 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +81 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/version/changelog-file-utils.d.ts +69 -0
- package/dist/version/changelog-file-utils.d.ts.map +1 -0
- package/dist/version/changelog-file-utils.js +161 -0
- package/dist/version/changelog-file-utils.js.map +1 -0
- package/dist/version/changelog-utils.d.ts +98 -0
- package/dist/version/changelog-utils.d.ts.map +1 -0
- package/dist/version/changelog-utils.js +198 -0
- package/dist/version/changelog-utils.js.map +1 -0
- package/dist/version/dry-run-utils.d.ts +108 -0
- package/dist/version/dry-run-utils.d.ts.map +1 -0
- package/dist/version/dry-run-utils.js +126 -0
- package/dist/version/dry-run-utils.js.map +1 -0
- package/dist/version/git-tag-utils.d.ts +50 -0
- package/dist/version/git-tag-utils.d.ts.map +1 -0
- package/dist/version/git-tag-utils.js +66 -0
- package/dist/version/git-tag-utils.js.map +1 -0
- package/dist/version/index.d.ts +11 -0
- package/dist/version/index.d.ts.map +1 -0
- package/dist/version/index.js +11 -0
- package/dist/version/index.js.map +1 -0
- package/dist/version/release-utils.d.ts +94 -0
- package/dist/version/release-utils.d.ts.map +1 -0
- package/dist/version/release-utils.js +170 -0
- package/dist/version/release-utils.js.map +1 -0
- package/dist/version/rollback-utils.d.ts +47 -0
- package/dist/version/rollback-utils.d.ts.map +1 -0
- package/dist/version/rollback-utils.js +73 -0
- package/dist/version/rollback-utils.js.map +1 -0
- package/dist/version/version-manager.d.ts +98 -0
- package/dist/version/version-manager.d.ts.map +1 -0
- package/dist/version/version-manager.js +158 -0
- package/dist/version/version-manager.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelog File Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for reading, parsing, and updating CHANGELOG.md files.
|
|
5
|
+
* Ensures idempotent operations and proper version section ordering.
|
|
6
|
+
*/
|
|
7
|
+
export interface ChangelogSection {
|
|
8
|
+
version: string;
|
|
9
|
+
date: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ChangelogEntry {
|
|
13
|
+
version: string;
|
|
14
|
+
date: string;
|
|
15
|
+
features?: string[];
|
|
16
|
+
fixes?: string[];
|
|
17
|
+
breaking?: string[];
|
|
18
|
+
other?: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parses a CHANGELOG.md file into structured sections.
|
|
22
|
+
*
|
|
23
|
+
* @param changelogContent - The raw content of CHANGELOG.md
|
|
24
|
+
* @returns Array of changelog sections, ordered from newest to oldest
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseChangelog(changelogContent: string): ChangelogSection[];
|
|
27
|
+
/**
|
|
28
|
+
* Formats a changelog entry as markdown.
|
|
29
|
+
*
|
|
30
|
+
* @param entry - The changelog entry to format
|
|
31
|
+
* @returns Formatted markdown string
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatChangelogEntry(entry: ChangelogEntry): string;
|
|
34
|
+
/**
|
|
35
|
+
* Adds a new version section to an existing changelog.
|
|
36
|
+
*
|
|
37
|
+
* This operation is idempotent:
|
|
38
|
+
* - If the version already exists, the changelog is returned unchanged
|
|
39
|
+
* - New sections are always placed at the top (after the title)
|
|
40
|
+
* - All existing sections are preserved in their original order
|
|
41
|
+
*
|
|
42
|
+
* @param existingChangelog - The current changelog content
|
|
43
|
+
* @param newEntry - The new changelog entry to add
|
|
44
|
+
* @returns Updated changelog content with the new entry at the top
|
|
45
|
+
*/
|
|
46
|
+
export declare function addChangelogEntry(existingChangelog: string, newEntry: ChangelogEntry): string;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new changelog with an initial entry.
|
|
49
|
+
*
|
|
50
|
+
* @param entry - The initial changelog entry
|
|
51
|
+
* @returns New changelog content with title and entry
|
|
52
|
+
*/
|
|
53
|
+
export declare function createChangelog(entry: ChangelogEntry): string;
|
|
54
|
+
/**
|
|
55
|
+
* Extracts all version numbers from a changelog.
|
|
56
|
+
*
|
|
57
|
+
* @param changelogContent - The changelog content to parse
|
|
58
|
+
* @returns Array of version strings, ordered from newest to oldest
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractVersions(changelogContent: string): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Checks if a version exists in the changelog.
|
|
63
|
+
*
|
|
64
|
+
* @param changelogContent - The changelog content to check
|
|
65
|
+
* @param version - The version to look for
|
|
66
|
+
* @returns true if the version exists, false otherwise
|
|
67
|
+
*/
|
|
68
|
+
export declare function hasVersion(changelogContent: string, version: string): boolean;
|
|
69
|
+
//# sourceMappingURL=changelog-file-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-file-utils.d.ts","sourceRoot":"","sources":["../../src/version/changelog-file-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAmC3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAgDlE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,cAAc,GACvB,MAAM,CAkCR;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE,CAGlE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAG7E"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelog File Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for reading, parsing, and updating CHANGELOG.md files.
|
|
5
|
+
* Ensures idempotent operations and proper version section ordering.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parses a CHANGELOG.md file into structured sections.
|
|
9
|
+
*
|
|
10
|
+
* @param changelogContent - The raw content of CHANGELOG.md
|
|
11
|
+
* @returns Array of changelog sections, ordered from newest to oldest
|
|
12
|
+
*/
|
|
13
|
+
export function parseChangelog(changelogContent) {
|
|
14
|
+
const sections = [];
|
|
15
|
+
// Split by version headers (## [version] - date or ## version - date)
|
|
16
|
+
const versionHeaderRegex = /^## \[?(\d+\.\d+\.\d+)\]?\s*-\s*(.+)$/gm;
|
|
17
|
+
let match;
|
|
18
|
+
const matches = [];
|
|
19
|
+
while ((match = versionHeaderRegex.exec(changelogContent)) !== null) {
|
|
20
|
+
matches.push({
|
|
21
|
+
version: match[1],
|
|
22
|
+
date: match[2],
|
|
23
|
+
index: match.index,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
// Extract content for each section
|
|
27
|
+
for (let i = 0; i < matches.length; i++) {
|
|
28
|
+
const current = matches[i];
|
|
29
|
+
const next = matches[i + 1];
|
|
30
|
+
const startIndex = current.index;
|
|
31
|
+
const endIndex = next ? next.index : changelogContent.length;
|
|
32
|
+
const sectionContent = changelogContent.substring(startIndex, endIndex).trim();
|
|
33
|
+
sections.push({
|
|
34
|
+
version: current.version,
|
|
35
|
+
date: current.date,
|
|
36
|
+
content: sectionContent,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return sections;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Formats a changelog entry as markdown.
|
|
43
|
+
*
|
|
44
|
+
* @param entry - The changelog entry to format
|
|
45
|
+
* @returns Formatted markdown string
|
|
46
|
+
*/
|
|
47
|
+
export function formatChangelogEntry(entry) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
// Header
|
|
50
|
+
lines.push(`## [${entry.version}] - ${entry.date}`);
|
|
51
|
+
lines.push('');
|
|
52
|
+
// Features
|
|
53
|
+
if (entry.features && entry.features.length > 0) {
|
|
54
|
+
lines.push('### Features');
|
|
55
|
+
lines.push('');
|
|
56
|
+
entry.features.forEach(feature => {
|
|
57
|
+
lines.push(`- ${feature}`);
|
|
58
|
+
});
|
|
59
|
+
lines.push('');
|
|
60
|
+
}
|
|
61
|
+
// Bug Fixes
|
|
62
|
+
if (entry.fixes && entry.fixes.length > 0) {
|
|
63
|
+
lines.push('### Bug Fixes');
|
|
64
|
+
lines.push('');
|
|
65
|
+
entry.fixes.forEach(fix => {
|
|
66
|
+
lines.push(`- ${fix}`);
|
|
67
|
+
});
|
|
68
|
+
lines.push('');
|
|
69
|
+
}
|
|
70
|
+
// Breaking Changes
|
|
71
|
+
if (entry.breaking && entry.breaking.length > 0) {
|
|
72
|
+
lines.push('### Breaking Changes');
|
|
73
|
+
lines.push('');
|
|
74
|
+
entry.breaking.forEach(breaking => {
|
|
75
|
+
lines.push(`- ${breaking}`);
|
|
76
|
+
});
|
|
77
|
+
lines.push('');
|
|
78
|
+
}
|
|
79
|
+
// Other changes
|
|
80
|
+
if (entry.other && entry.other.length > 0) {
|
|
81
|
+
lines.push('### Other Changes');
|
|
82
|
+
lines.push('');
|
|
83
|
+
entry.other.forEach(other => {
|
|
84
|
+
lines.push(`- ${other}`);
|
|
85
|
+
});
|
|
86
|
+
lines.push('');
|
|
87
|
+
}
|
|
88
|
+
return lines.join('\n');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Adds a new version section to an existing changelog.
|
|
92
|
+
*
|
|
93
|
+
* This operation is idempotent:
|
|
94
|
+
* - If the version already exists, the changelog is returned unchanged
|
|
95
|
+
* - New sections are always placed at the top (after the title)
|
|
96
|
+
* - All existing sections are preserved in their original order
|
|
97
|
+
*
|
|
98
|
+
* @param existingChangelog - The current changelog content
|
|
99
|
+
* @param newEntry - The new changelog entry to add
|
|
100
|
+
* @returns Updated changelog content with the new entry at the top
|
|
101
|
+
*/
|
|
102
|
+
export function addChangelogEntry(existingChangelog, newEntry) {
|
|
103
|
+
// Parse existing changelog
|
|
104
|
+
const existingSections = parseChangelog(existingChangelog);
|
|
105
|
+
// Check if version already exists (idempotence)
|
|
106
|
+
const versionExists = existingSections.some(section => section.version === newEntry.version);
|
|
107
|
+
if (versionExists) {
|
|
108
|
+
// Return unchanged if version already exists
|
|
109
|
+
return existingChangelog;
|
|
110
|
+
}
|
|
111
|
+
// Format the new entry
|
|
112
|
+
const newEntryContent = formatChangelogEntry(newEntry);
|
|
113
|
+
// Find the title line (# Changelog or similar)
|
|
114
|
+
const titleRegex = /^#\s+.+$/m;
|
|
115
|
+
const titleMatch = existingChangelog.match(titleRegex);
|
|
116
|
+
if (titleMatch && titleMatch.index !== undefined) {
|
|
117
|
+
// Insert after title
|
|
118
|
+
const titleEndIndex = titleMatch.index + titleMatch[0].length;
|
|
119
|
+
const before = existingChangelog.substring(0, titleEndIndex);
|
|
120
|
+
const after = existingChangelog.substring(titleEndIndex);
|
|
121
|
+
// Add new entry with proper spacing
|
|
122
|
+
return `${before}\n\n${newEntryContent}\n${after.trimStart()}`;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// No title found, prepend to the beginning
|
|
126
|
+
return `${newEntryContent}\n\n${existingChangelog}`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates a new changelog with an initial entry.
|
|
131
|
+
*
|
|
132
|
+
* @param entry - The initial changelog entry
|
|
133
|
+
* @returns New changelog content with title and entry
|
|
134
|
+
*/
|
|
135
|
+
export function createChangelog(entry) {
|
|
136
|
+
const title = '# Changelog\n\n';
|
|
137
|
+
const entryContent = formatChangelogEntry(entry);
|
|
138
|
+
return title + entryContent;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Extracts all version numbers from a changelog.
|
|
142
|
+
*
|
|
143
|
+
* @param changelogContent - The changelog content to parse
|
|
144
|
+
* @returns Array of version strings, ordered from newest to oldest
|
|
145
|
+
*/
|
|
146
|
+
export function extractVersions(changelogContent) {
|
|
147
|
+
const sections = parseChangelog(changelogContent);
|
|
148
|
+
return sections.map(section => section.version);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Checks if a version exists in the changelog.
|
|
152
|
+
*
|
|
153
|
+
* @param changelogContent - The changelog content to check
|
|
154
|
+
* @param version - The version to look for
|
|
155
|
+
* @returns true if the version exists, false otherwise
|
|
156
|
+
*/
|
|
157
|
+
export function hasVersion(changelogContent, version) {
|
|
158
|
+
const versions = extractVersions(changelogContent);
|
|
159
|
+
return versions.includes(version);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=changelog-file-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-file-utils.js","sourceRoot":"","sources":["../../src/version/changelog-file-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,gBAAwB;IACrD,MAAM,QAAQ,GAAuB,EAAE,CAAC;IAExC,sEAAsE;IACtE,MAAM,kBAAkB,GAAG,yCAAyC,CAAC;IAErE,IAAI,KAAK,CAAC;IACV,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,OAAO,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACpE,OAAO,CAAC,IAAI,CAAC;YACX,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YACjB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACd,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;IACL,CAAC;IAED,mCAAmC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE5B,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAE7D,MAAM,cAAc,GAAG,gBAAgB,CAAC,SAAS,CAAC,UAAU,EAAE,Q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;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,gBAAwB,EAAE,OAAe;IAClE,MAAM,QAAQ,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IACnD,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelog Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for parsing conventional commits and grouping them by type.
|
|
5
|
+
* Follows the Conventional Commits specification (conventionalcommits.org).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Represents a parsed conventional commit
|
|
9
|
+
*/
|
|
10
|
+
export interface ConventionalCommit {
|
|
11
|
+
type: string;
|
|
12
|
+
scope?: string;
|
|
13
|
+
message: string;
|
|
14
|
+
breaking: boolean;
|
|
15
|
+
raw: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents grouped commits by type
|
|
19
|
+
*/
|
|
20
|
+
export interface GroupedCommits {
|
|
21
|
+
[type: string]: ConventionalCommit[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Standard commit types used in conventional commits
|
|
25
|
+
*/
|
|
26
|
+
export declare const COMMIT_TYPES: readonly ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"];
|
|
27
|
+
/**
|
|
28
|
+
* Parses a conventional commit message.
|
|
29
|
+
*
|
|
30
|
+
* Format: type(scope): message
|
|
31
|
+
* or: type: message
|
|
32
|
+
*
|
|
33
|
+
* Breaking changes are indicated by:
|
|
34
|
+
* - BREAKING CHANGE: in the commit body
|
|
35
|
+
* - ! after type/scope: type!: message or type(scope)!: message
|
|
36
|
+
*
|
|
37
|
+
* @param commitMessage - The commit message to parse
|
|
38
|
+
* @returns Parsed conventional commit object, or null if not a valid conventional commit
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseConventionalCommit(commitMessage: string): ConventionalCommit | null;
|
|
41
|
+
/**
|
|
42
|
+
* Groups an array of conventional commits by their type.
|
|
43
|
+
*
|
|
44
|
+
* Commits are grouped into sections based on their type prefix:
|
|
45
|
+
* - feat: Features
|
|
46
|
+
* - fix: Bug Fixes
|
|
47
|
+
* - docs: Documentation
|
|
48
|
+
* - etc.
|
|
49
|
+
*
|
|
50
|
+
* @param commits - Array of commit messages to group
|
|
51
|
+
* @returns Object with commit types as keys and arrays of commits as values
|
|
52
|
+
*/
|
|
53
|
+
export declare function groupCommitsByType(commits: string[]): GroupedCommits;
|
|
54
|
+
/**
|
|
55
|
+
* Checks if a commit message follows the conventional commit format.
|
|
56
|
+
*
|
|
57
|
+
* @param commitMessage - The commit message to validate
|
|
58
|
+
* @returns true if the message follows conventional commit format, false otherwise
|
|
59
|
+
*/
|
|
60
|
+
export declare function isConventionalCommit(commitMessage: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Gets all unique commit types from an array of commits.
|
|
63
|
+
*
|
|
64
|
+
* @param commits - Array of commit messages
|
|
65
|
+
* @returns Array of unique commit types found
|
|
66
|
+
*/
|
|
67
|
+
export declare function getCommitTypes(commits: string[]): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Filters commits by type.
|
|
70
|
+
*
|
|
71
|
+
* @param commits - Array of commit messages
|
|
72
|
+
* @param type - The commit type to filter by (e.g., 'feat', 'fix')
|
|
73
|
+
* @returns Array of commits matching the specified type
|
|
74
|
+
*/
|
|
75
|
+
export declare function filterCommitsByType(commits: string[], type: string): ConventionalCommit[];
|
|
76
|
+
/**
|
|
77
|
+
* Result of a dry run changelog generation
|
|
78
|
+
*/
|
|
79
|
+
export interface DryRunChangelogResult {
|
|
80
|
+
version: string;
|
|
81
|
+
date: string;
|
|
82
|
+
commits: GroupedCommits;
|
|
83
|
+
preview: string;
|
|
84
|
+
isDryRun: true;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Generates a changelog preview without writing to files.
|
|
88
|
+
*
|
|
89
|
+
* This function is used in dry run mode to preview changelog content.
|
|
90
|
+
*
|
|
91
|
+
* @param version - The version for this changelog entry
|
|
92
|
+
* @param commits - Array of commit messages since last release
|
|
93
|
+
* @returns Dry run result with changelog preview
|
|
94
|
+
*
|
|
95
|
+
* Validates: Requirements 15.3
|
|
96
|
+
*/
|
|
97
|
+
export declare function generateDryRunChangelog(version: string, commits: string[]): DryRunChangelogResult;
|
|
98
|
+
//# sourceMappingURL=changelog-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-utils.d.ts","sourceRoot":"","sources":["../../src/version/changelog-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAAC;CACtC;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,yGAYf,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAsCxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,CAkBpE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAW1D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAWzF;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,IAAI,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EAAE,GAChB,qBAAqB,CAwDvB"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Changelog Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for parsing conventional commits and grouping them by type.
|
|
5
|
+
* Follows the Conventional Commits specification (conventionalcommits.org).
|
|
6
|
+
*/
|
|
7
|
+
import { isDryRunEnabled, logDryRunAction } from './dry-run-utils.js';
|
|
8
|
+
/**
|
|
9
|
+
* Standard commit types used in conventional commits
|
|
10
|
+
*/
|
|
11
|
+
export const COMMIT_TYPES = [
|
|
12
|
+
'feat',
|
|
13
|
+
'fix',
|
|
14
|
+
'docs',
|
|
15
|
+
'style',
|
|
16
|
+
'refactor',
|
|
17
|
+
'perf',
|
|
18
|
+
'test',
|
|
19
|
+
'build',
|
|
20
|
+
'ci',
|
|
21
|
+
'chore',
|
|
22
|
+
'revert',
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Parses a conventional commit message.
|
|
26
|
+
*
|
|
27
|
+
* Format: type(scope): message
|
|
28
|
+
* or: type: message
|
|
29
|
+
*
|
|
30
|
+
* Breaking changes are indicated by:
|
|
31
|
+
* - BREAKING CHANGE: in the commit body
|
|
32
|
+
* - ! after type/scope: type!: message or type(scope)!: message
|
|
33
|
+
*
|
|
34
|
+
* @param commitMessage - The commit message to parse
|
|
35
|
+
* @returns Parsed conventional commit object, or null if not a valid conventional commit
|
|
36
|
+
*/
|
|
37
|
+
export function parseConventionalCommit(commitMessage) {
|
|
38
|
+
if (!commitMessage || typeof commitMessage !== 'string') {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
// Split into header and body
|
|
42
|
+
const lines = commitMessage.split('\n');
|
|
43
|
+
const header = lines[0];
|
|
44
|
+
const body = lines.slice(1).join('\n');
|
|
45
|
+
// Check for BREAKING CHANGE in body
|
|
46
|
+
const hasBreakingInBody = body.includes('BREAKING CHANGE:') || body.includes('BREAKING-CHANGE:');
|
|
47
|
+
// Regex to match conventional commit header
|
|
48
|
+
// Matches: type(scope)!: message or type!: message or type(scope): message or type: message
|
|
49
|
+
// Note: Type must be lowercase (no 'i' flag) per conventional commits spec
|
|
50
|
+
// The regex requires at least one space after colon, then captures everything after that first space
|
|
51
|
+
const conventionalCommitRegex = /^([a-z]+)(?:\(([^)]+)\))?(!)?:\s(.*)$/;
|
|
52
|
+
const match = header.match(conventionalCommitRegex);
|
|
53
|
+
if (!match) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const [, type, scope, breakingMarker, message] = match;
|
|
57
|
+
// Message must not be empty (after the required space)
|
|
58
|
+
if (!message || message.length === 0) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
type: type,
|
|
63
|
+
scope: scope || undefined,
|
|
64
|
+
message: message,
|
|
65
|
+
breaking: !!breakingMarker || hasBreakingInBody,
|
|
66
|
+
raw: commitMessage,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Groups an array of conventional commits by their type.
|
|
71
|
+
*
|
|
72
|
+
* Commits are grouped into sections based on their type prefix:
|
|
73
|
+
* - feat: Features
|
|
74
|
+
* - fix: Bug Fixes
|
|
75
|
+
* - docs: Documentation
|
|
76
|
+
* - etc.
|
|
77
|
+
*
|
|
78
|
+
* @param commits - Array of commit messages to group
|
|
79
|
+
* @returns Object with commit types as keys and arrays of commits as values
|
|
80
|
+
*/
|
|
81
|
+
export function groupCommitsByType(commits) {
|
|
82
|
+
const grouped = {};
|
|
83
|
+
for (const commit of commits) {
|
|
84
|
+
const parsed = parseConventionalCommit(commit);
|
|
85
|
+
if (parsed) {
|
|
86
|
+
const type = parsed.type;
|
|
87
|
+
if (!grouped[type]) {
|
|
88
|
+
grouped[type] = [];
|
|
89
|
+
}
|
|
90
|
+
grouped[type].push(parsed);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return grouped;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Checks if a commit message follows the conventional commit format.
|
|
97
|
+
*
|
|
98
|
+
* @param commitMessage - The commit message to validate
|
|
99
|
+
* @returns true if the message follows conventional commit format, false otherwise
|
|
100
|
+
*/
|
|
101
|
+
export function isConventionalCommit(commitMessage) {
|
|
102
|
+
return parseConventionalCommit(commitMessage) !== null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets all unique commit types from an array of commits.
|
|
106
|
+
*
|
|
107
|
+
* @param commits - Array of commit messages
|
|
108
|
+
* @returns Array of unique commit types found
|
|
109
|
+
*/
|
|
110
|
+
export function getCommitTypes(commits) {
|
|
111
|
+
const types = new Set();
|
|
112
|
+
for (const commit of commits) {
|
|
113
|
+
const parsed = parseConventionalCommit(commit);
|
|
114
|
+
if (parsed) {
|
|
115
|
+
types.add(parsed.type);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return Array.from(types).sort();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Filters commits by type.
|
|
122
|
+
*
|
|
123
|
+
* @param commits - Array of commit messages
|
|
124
|
+
* @param type - The commit type to filter by (e.g., 'feat', 'fix')
|
|
125
|
+
* @returns Array of commits matching the specified type
|
|
126
|
+
*/
|
|
127
|
+
export function filterCommitsByType(commits, type) {
|
|
128
|
+
const filtered = [];
|
|
129
|
+
for (const commit of commits) {
|
|
130
|
+
const parsed = parseConventionalCommit(commit);
|
|
131
|
+
if (parsed && parsed.type === type.toLowerCase()) {
|
|
132
|
+
filtered.push(parsed);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return filtered;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Generates a changelog preview without writing to files.
|
|
139
|
+
*
|
|
140
|
+
* This function is used in dry run mode to preview changelog content.
|
|
141
|
+
*
|
|
142
|
+
* @param version - The version for this changelog entry
|
|
143
|
+
* @param commits - Array of commit messages since last release
|
|
144
|
+
* @returns Dry run result with changelog preview
|
|
145
|
+
*
|
|
146
|
+
* Validates: Requirements 15.3
|
|
147
|
+
*/
|
|
148
|
+
export function generateDryRunChangelog(version, commits) {
|
|
149
|
+
const grouped = groupCommitsByType(commits);
|
|
150
|
+
const date = new Date().toISOString().split('T')[0];
|
|
151
|
+
// Generate markdown preview
|
|
152
|
+
let preview = `## ${version} (${date})\n\n`;
|
|
153
|
+
// Add breaking changes first if any
|
|
154
|
+
const breakingChanges = [];
|
|
155
|
+
for (const type in grouped) {
|
|
156
|
+
breakingChanges.push(...grouped[type].filter(c => c.breaking));
|
|
157
|
+
}
|
|
158
|
+
if (breakingChanges.length > 0) {
|
|
159
|
+
preview += '### ⚠ BREAKING CHANGES\n\n';
|
|
160
|
+
for (const commit of breakingChanges) {
|
|
161
|
+
const scope = commit.scope ? `**${commit.scope}**: ` : '';
|
|
162
|
+
preview += `* ${scope}${commit.message}\n`;
|
|
163
|
+
}
|
|
164
|
+
preview += '\n';
|
|
165
|
+
}
|
|
166
|
+
// Add features
|
|
167
|
+
if (grouped['feat']) {
|
|
168
|
+
preview += '### Features\n\n';
|
|
169
|
+
for (const commit of grouped['feat']) {
|
|
170
|
+
const scope = commit.scope ? `**${commit.scope}**: ` : '';
|
|
171
|
+
preview += `* ${scope}${commit.message}\n`;
|
|
172
|
+
}
|
|
173
|
+
preview += '\n';
|
|
174
|
+
}
|
|
175
|
+
// Add bug fixes
|
|
176
|
+
if (grouped['fix']) {
|
|
177
|
+
preview += '### Bug Fixes\n\n';
|
|
178
|
+
for (const commit of grouped['fix']) {
|
|
179
|
+
const scope = commit.scope ? `**${commit.scope}**: ` : '';
|
|
180
|
+
preview += `* ${scope}${commit.message}\n`;
|
|
181
|
+
}
|
|
182
|
+
preview += '\n';
|
|
183
|
+
}
|
|
184
|
+
if (isDryRunEnabled()) {
|
|
185
|
+
logDryRunAction(`Generate changelog for version ${version} with ${commits.length} commits`);
|
|
186
|
+
console.log('\n--- Changelog Preview ---\n');
|
|
187
|
+
console.log(preview);
|
|
188
|
+
console.log('--- End Preview ---\n');
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
version,
|
|
192
|
+
date,
|
|
193
|
+
commits: grouped,
|
|
194
|
+
preview,
|
|
195
|
+
isDryRun: true,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=changelog-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-utils.js","sourceRoot":"","sources":["../../src/version/changelog-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAoBtE;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;IACP,IAAI;IACJ,OAAO;IACP,QAAQ;CACA,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB,CAAC,aAAqB;IAC3D,IAAI,CAAC,aAAa,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6BAA6B;IAC7B,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAA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C;QACnB,OAAO,IAAI,mBAAmB,CAAC;QAC/B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,IAAI,KAAK,KAAK,GAAG,MAAM,CAAC,OAAO,IAAI,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,IAAI,CAAC;IAClB,CAAC;IAED,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,eAAe,CAAC,kCAAkC,OAAO,SAAS,OAAO,CAAC,MAAM,UAAU,CAAC,CAAC;QAC5F,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,OAAO;QACL,OAAO;QACP,IAAI;QACJ,OAAO,EAAE,OAAO;QAChB,OAAO;QACP,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dry Run Mode Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for detecting and managing dry run mode in the release pipeline.
|
|
5
|
+
* Dry run mode allows testing the release process without actually publishing or making changes.
|
|
6
|
+
*
|
|
7
|
+
* Validates: Requirements 15.1
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Checks if dry run mode is enabled via environment variable.
|
|
11
|
+
*
|
|
12
|
+
* Dry run mode is enabled when the DRY_RUN environment variable is set to:
|
|
13
|
+
* - "true" (case-insensitive)
|
|
14
|
+
* - "1"
|
|
15
|
+
* - "yes" (case-insensitive)
|
|
16
|
+
*
|
|
17
|
+
* @returns true if dry run mode is enabled, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
export declare function isDryRunEnabled(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the dry run mode status as a boolean.
|
|
22
|
+
*
|
|
23
|
+
* This is an alias for isDryRunEnabled() that provides a more explicit API.
|
|
24
|
+
*
|
|
25
|
+
* @returns true if dry run mode is enabled, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDryRunMode(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if the current execution should perform actual changes.
|
|
30
|
+
*
|
|
31
|
+
* This is the inverse of isDryRunEnabled() and can be used to guard
|
|
32
|
+
* operations that should only execute in non-dry-run mode.
|
|
33
|
+
*
|
|
34
|
+
* @returns true if actual changes should be made, false if in dry run mode
|
|
35
|
+
*/
|
|
36
|
+
export declare function shouldExecuteChanges(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Configuration object for dry run mode.
|
|
39
|
+
*/
|
|
40
|
+
export interface DryRunConfig {
|
|
41
|
+
/**
|
|
42
|
+
* Whether dry run mode is enabled
|
|
43
|
+
*/
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The raw value of the DRY_RUN environment variable
|
|
47
|
+
*/
|
|
48
|
+
rawValue: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the complete dry run configuration.
|
|
52
|
+
*
|
|
53
|
+
* @returns Configuration object with dry run status and raw environment value
|
|
54
|
+
*/
|
|
55
|
+
export declare function getDryRunConfig(): DryRunConfig;
|
|
56
|
+
/**
|
|
57
|
+
* Logs a dry run action message to the console.
|
|
58
|
+
*
|
|
59
|
+
* This helper function formats and logs messages about actions that would
|
|
60
|
+
* be performed in a real release but are skipped in dry run mode.
|
|
61
|
+
*
|
|
62
|
+
* @param action - Description of the action that would be performed
|
|
63
|
+
*/
|
|
64
|
+
export declare function logDryRunAction(action: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Logs a dry run skip message to the console.
|
|
67
|
+
*
|
|
68
|
+
* This helper function formats and logs messages about operations that
|
|
69
|
+
* are being skipped due to dry run mode.
|
|
70
|
+
*
|
|
71
|
+
* @param operation - Description of the operation being skipped
|
|
72
|
+
*/
|
|
73
|
+
export declare function logDryRunSkip(operation: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Action that would be performed in a real release
|
|
76
|
+
*/
|
|
77
|
+
export interface DryRunAction {
|
|
78
|
+
type: 'version' | 'changelog' | 'git' | 'npm' | 'release';
|
|
79
|
+
description: string;
|
|
80
|
+
details?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Summary of all actions that would be performed in dry run mode
|
|
84
|
+
*/
|
|
85
|
+
export interface DryRunSummary {
|
|
86
|
+
actions: DryRunAction[];
|
|
87
|
+
totalActions: number;
|
|
88
|
+
timestamp: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Creates a summary of actions that would be performed in a release.
|
|
92
|
+
*
|
|
93
|
+
* This function is used in dry run mode to provide a comprehensive overview
|
|
94
|
+
* of all operations that would be executed in a real release.
|
|
95
|
+
*
|
|
96
|
+
* @param actions - Array of actions that would be performed
|
|
97
|
+
* @returns Summary object with all actions and metadata
|
|
98
|
+
*
|
|
99
|
+
* Validates: Requirements 15.5
|
|
100
|
+
*/
|
|
101
|
+
export declare function createDryRunSummary(actions: DryRunAction[]): DryRunSummary;
|
|
102
|
+
/**
|
|
103
|
+
* Displays a formatted dry run summary to the console.
|
|
104
|
+
*
|
|
105
|
+
* @param summary - The dry run summary to display
|
|
106
|
+
*/
|
|
107
|
+
export declare function displayDryRunSummary(summary: DryRunSummary): void;
|
|
108
|
+
//# sourceMappingURL=dry-run-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dry-run-utils.d.ts","sourceRoot":"","sources":["../../src/version/dry-run-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAUzC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAK9C;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,CAM1E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CA0BjE"}
|