@muverse/core 0.1.0
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 +22 -0
- package/dist/adapters/gradle/constants.d.ts +13 -0
- package/dist/adapters/gradle/constants.d.ts.map +1 -0
- package/dist/adapters/gradle/constants.js +12 -0
- package/dist/adapters/gradle/gradle-project-information.d.ts +18 -0
- package/dist/adapters/gradle/gradle-project-information.d.ts.map +1 -0
- package/dist/adapters/gradle/gradle-project-information.js +93 -0
- package/dist/adapters/gradle/gradle-properties.d.ts +15 -0
- package/dist/adapters/gradle/gradle-properties.d.ts.map +1 -0
- package/dist/adapters/gradle/gradle-properties.js +46 -0
- package/dist/adapters/gradle/init-project-information.gradle.kts +143 -0
- package/dist/adapters/gradle/services/gradle-adapter-identifier.d.ts +21 -0
- package/dist/adapters/gradle/services/gradle-adapter-identifier.d.ts.map +1 -0
- package/dist/adapters/gradle/services/gradle-adapter-identifier.js +44 -0
- package/dist/adapters/gradle/services/gradle-module-detector.d.ts +18 -0
- package/dist/adapters/gradle/services/gradle-module-detector.d.ts.map +1 -0
- package/dist/adapters/gradle/services/gradle-module-detector.js +26 -0
- package/dist/adapters/gradle/services/gradle-module-system-factory.d.ts +23 -0
- package/dist/adapters/gradle/services/gradle-module-system-factory.d.ts.map +1 -0
- package/dist/adapters/gradle/services/gradle-module-system-factory.js +27 -0
- package/dist/adapters/gradle/services/gradle-version-update-strategy.d.ts +21 -0
- package/dist/adapters/gradle/services/gradle-version-update-strategy.d.ts.map +1 -0
- package/dist/adapters/gradle/services/gradle-version-update-strategy.js +36 -0
- package/dist/adapters/project-information.d.ts +58 -0
- package/dist/adapters/project-information.d.ts.map +1 -0
- package/dist/adapters/project-information.js +1 -0
- package/dist/changelog/index.d.ts +27 -0
- package/dist/changelog/index.d.ts.map +1 -0
- package/dist/changelog/index.js +204 -0
- package/dist/config/index.d.ts +122 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +115 -0
- package/dist/factories/adapter-identifier-registry.d.ts +12 -0
- package/dist/factories/adapter-identifier-registry.d.ts.map +1 -0
- package/dist/factories/adapter-identifier-registry.js +24 -0
- package/dist/factories/module-system-factory.d.ts +10 -0
- package/dist/factories/module-system-factory.d.ts.map +1 -0
- package/dist/factories/module-system-factory.js +18 -0
- package/dist/git/index.d.ts +253 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +581 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/semver/index.d.ts +85 -0
- package/dist/semver/index.d.ts.map +1 -0
- package/dist/semver/index.js +176 -0
- package/dist/services/adapter-identifier-registry.d.ts +38 -0
- package/dist/services/adapter-identifier-registry.d.ts.map +1 -0
- package/dist/services/adapter-identifier-registry.js +59 -0
- package/dist/services/adapter-identifier.d.ts +31 -0
- package/dist/services/adapter-identifier.d.ts.map +1 -0
- package/dist/services/adapter-identifier.js +1 -0
- package/dist/services/adapter-metadata-provider.d.ts +51 -0
- package/dist/services/adapter-metadata-provider.d.ts.map +1 -0
- package/dist/services/adapter-metadata-provider.js +66 -0
- package/dist/services/changelog-generator.d.ts +13 -0
- package/dist/services/changelog-generator.d.ts.map +1 -0
- package/dist/services/changelog-generator.js +26 -0
- package/dist/services/commit-analyzer.d.ts +44 -0
- package/dist/services/commit-analyzer.d.ts.map +1 -0
- package/dist/services/commit-analyzer.js +86 -0
- package/dist/services/configuration-loader.d.ts +23 -0
- package/dist/services/configuration-loader.d.ts.map +1 -0
- package/dist/services/configuration-loader.js +79 -0
- package/dist/services/configuration-validator.d.ts +16 -0
- package/dist/services/configuration-validator.d.ts.map +1 -0
- package/dist/services/configuration-validator.js +24 -0
- package/dist/services/git-operations.d.ts +16 -0
- package/dist/services/git-operations.d.ts.map +1 -0
- package/dist/services/git-operations.js +89 -0
- package/dist/services/module-detector.d.ts +24 -0
- package/dist/services/module-detector.d.ts.map +1 -0
- package/dist/services/module-detector.js +1 -0
- package/dist/services/module-registry.d.ts +45 -0
- package/dist/services/module-registry.d.ts.map +1 -0
- package/dist/services/module-registry.js +57 -0
- package/dist/services/module-system-factory.d.ts +24 -0
- package/dist/services/module-system-factory.d.ts.map +1 -0
- package/dist/services/module-system-factory.js +1 -0
- package/dist/services/verse-runner.d.ts +45 -0
- package/dist/services/verse-runner.d.ts.map +1 -0
- package/dist/services/verse-runner.js +182 -0
- package/dist/services/version-applier.d.ts +26 -0
- package/dist/services/version-applier.d.ts.map +1 -0
- package/dist/services/version-applier.js +63 -0
- package/dist/services/version-bumper.d.ts +156 -0
- package/dist/services/version-bumper.d.ts.map +1 -0
- package/dist/services/version-bumper.js +291 -0
- package/dist/services/version-manager.d.ts +68 -0
- package/dist/services/version-manager.d.ts.map +1 -0
- package/dist/services/version-manager.js +94 -0
- package/dist/services/version-update-strategy.d.ts +18 -0
- package/dist/services/version-update-strategy.d.ts.map +1 -0
- package/dist/services/version-update-strategy.js +1 -0
- package/dist/utils/banner.d.ts +2 -0
- package/dist/utils/banner.d.ts.map +1 -0
- package/dist/utils/banner.js +8 -0
- package/dist/utils/commits.d.ts +12 -0
- package/dist/utils/commits.d.ts.map +1 -0
- package/dist/utils/commits.js +24 -0
- package/dist/utils/file.d.ts +7 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +19 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +22 -0
- package/dist/utils/properties.d.ts +16 -0
- package/dist/utils/properties.d.ts.map +1 -0
- package/dist/utils/properties.js +62 -0
- package/dist/utils/versioning.d.ts +8 -0
- package/dist/utils/versioning.d.ts.map +1 -0
- package/dist/utils/versioning.js +17 -0
- package/package.json +70 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SemVer } from "semver";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a module within a project, containing metadata, version, and dependency information.
|
|
4
|
+
*/
|
|
5
|
+
export type Module = {
|
|
6
|
+
/** Unique identifier for the module within the project (e.g., ':', ':app', ':lib:core'). */
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/** Human-readable name of the module. */
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/** Relative path from the repository root to this module's directory. */
|
|
11
|
+
readonly path: string;
|
|
12
|
+
/** Type of the module: 'root' for top-level project or 'module' for subprojects. */
|
|
13
|
+
readonly type: "module" | "root";
|
|
14
|
+
/** Set of module IDs that are affected when this module changes. */
|
|
15
|
+
readonly affectedModules: Set<string>;
|
|
16
|
+
/** Current semantic version of the module. */
|
|
17
|
+
readonly version: SemVer;
|
|
18
|
+
/** Whether the version is explicitly declared in build configuration (vs inherited). */
|
|
19
|
+
readonly declaredVersion: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Structured representation of project information after processing.
|
|
23
|
+
* Provides efficient access to module information through arrays and maps.
|
|
24
|
+
*/
|
|
25
|
+
export type ProjectInformation = {
|
|
26
|
+
/** Array of all module identifiers in the project. */
|
|
27
|
+
readonly moduleIds: string[];
|
|
28
|
+
/** Map of module IDs to their complete module information (O(1) lookup). */
|
|
29
|
+
readonly modules: ReadonlyMap<string, Module>;
|
|
30
|
+
/** The module ID of the root project (typically ':' for Gradle). */
|
|
31
|
+
readonly rootModule: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Raw module data as extracted from the build system before processing.
|
|
35
|
+
* Similar to Module but with arrays instead of Sets and optional string version.
|
|
36
|
+
*/
|
|
37
|
+
export type RawModule = {
|
|
38
|
+
/** Human-readable name of the module. */
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/** Relative path from repository root to the module directory. */
|
|
41
|
+
readonly path: string;
|
|
42
|
+
/** Array of module IDs affected when this module changes. */
|
|
43
|
+
readonly affectedModules: string[];
|
|
44
|
+
/** Version string if the module has a version (optional). */
|
|
45
|
+
readonly version?: string;
|
|
46
|
+
/** Type of the module in the project hierarchy. */
|
|
47
|
+
readonly type: "module" | "root";
|
|
48
|
+
/** Whether the version is explicitly declared in build configuration. */
|
|
49
|
+
readonly declaredVersion: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Raw project structure information as extracted from the build system.
|
|
53
|
+
* Maps module IDs to their raw module data.
|
|
54
|
+
*/
|
|
55
|
+
export type RawProjectInformation = {
|
|
56
|
+
readonly [id: string]: RawModule;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=project-information.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-information.d.ts","sourceRoot":"","sources":["../../src/adapters/project-information.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEjC,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAEtC,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,wFAAwF;IACxF,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAE7B,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9C,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,6DAA6D;IAC7D,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAEnC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEjC,yEAAyE;IACzE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ModuleChangeResult } from "../services/version-applier.js";
|
|
2
|
+
import { CommitInfo } from "../git/index.js";
|
|
3
|
+
export type ChangelogEntry = {
|
|
4
|
+
readonly moduleResult: ModuleChangeResult;
|
|
5
|
+
readonly version: string;
|
|
6
|
+
readonly date: string;
|
|
7
|
+
readonly changes: {
|
|
8
|
+
readonly breaking: CommitInfo[];
|
|
9
|
+
readonly features: CommitInfo[];
|
|
10
|
+
readonly fixes: CommitInfo[];
|
|
11
|
+
readonly other: CommitInfo[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type ChangelogOptions = {
|
|
15
|
+
readonly includeCommitHashes: boolean;
|
|
16
|
+
readonly includeScopes: boolean;
|
|
17
|
+
readonly groupByType: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Generate changelog content for a module. */
|
|
20
|
+
export declare function generateChangelog(moduleResult: ModuleChangeResult, commits: CommitInfo[], options?: ChangelogOptions): Promise<string>;
|
|
21
|
+
/** Update or create a changelog file for a module. */
|
|
22
|
+
export declare function updateChangelogFile(moduleResult: ModuleChangeResult, changelogContent: string, repoRoot: string): Promise<string>;
|
|
23
|
+
/** Generate changelog for multiple modules. */
|
|
24
|
+
export declare function generateChangelogsForModules(moduleResults: ModuleChangeResult[], getCommitsForModule: (moduleId: string) => Promise<CommitInfo[]>, repoRoot: string, options?: ChangelogOptions): Promise<string[]>;
|
|
25
|
+
/** Generate a root changelog that summarizes all module changes. */
|
|
26
|
+
export declare function generateRootChangelog(moduleResults: ModuleChangeResult[], repoRoot: string): Promise<string>;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/changelog/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;QAChC,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;QAChC,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC;QAC7B,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,+CAA+C;AAC/C,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,kBAAkB,EAChC,OAAO,EAAE,UAAU,EAAE,EACrB,OAAO,GAAE,gBAIR,GACA,OAAO,CAAC,MAAM,CAAC,CA2BjB;AA4ED,sDAAsD;AACtD,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,kBAAkB,EAChC,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAqDjB;AAED,+CAA+C;AAC/C,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,kBAAkB,EAAE,EACnC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC,EAChE,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAqBnB;AAED,oEAAoE;AACpE,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,kBAAkB,EAAE,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA4DjB"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { promises as fs } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
/** Generate changelog content for a module. */
|
|
4
|
+
export async function generateChangelog(moduleResult, commits, options = {
|
|
5
|
+
includeCommitHashes: false,
|
|
6
|
+
includeScopes: true,
|
|
7
|
+
groupByType: true,
|
|
8
|
+
}) {
|
|
9
|
+
const entry = {
|
|
10
|
+
moduleResult,
|
|
11
|
+
version: moduleResult.to,
|
|
12
|
+
date: new Date().toISOString().split("T")[0], // YYYY-MM-DD format
|
|
13
|
+
changes: {
|
|
14
|
+
breaking: [],
|
|
15
|
+
features: [],
|
|
16
|
+
fixes: [],
|
|
17
|
+
other: [],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
// Categorize commits
|
|
21
|
+
for (const commit of commits) {
|
|
22
|
+
if (commit.breaking) {
|
|
23
|
+
entry.changes.breaking.push(commit);
|
|
24
|
+
}
|
|
25
|
+
else if (commit.type === "feat") {
|
|
26
|
+
entry.changes.features.push(commit);
|
|
27
|
+
}
|
|
28
|
+
else if (commit.type === "fix") {
|
|
29
|
+
entry.changes.fixes.push(commit);
|
|
30
|
+
}
|
|
31
|
+
else if (["perf", "refactor", "style"].includes(commit.type)) {
|
|
32
|
+
entry.changes.other.push(commit);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return formatChangelogEntry(entry, options);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Format changelog entry as markdown
|
|
39
|
+
*/
|
|
40
|
+
function formatChangelogEntry(entry, options) {
|
|
41
|
+
const version = entry.version;
|
|
42
|
+
let changelog = `## [${version}] - ${entry.date}\n\n`;
|
|
43
|
+
// Breaking changes first
|
|
44
|
+
if (entry.changes.breaking.length > 0) {
|
|
45
|
+
changelog += "### 💥 BREAKING CHANGES\n\n";
|
|
46
|
+
for (const commit of entry.changes.breaking) {
|
|
47
|
+
changelog += formatCommitLine(commit, options) + "\n";
|
|
48
|
+
}
|
|
49
|
+
changelog += "\n";
|
|
50
|
+
}
|
|
51
|
+
// Features
|
|
52
|
+
if (entry.changes.features.length > 0) {
|
|
53
|
+
changelog += "### ✨ Features\n\n";
|
|
54
|
+
for (const commit of entry.changes.features) {
|
|
55
|
+
changelog += formatCommitLine(commit, options) + "\n";
|
|
56
|
+
}
|
|
57
|
+
changelog += "\n";
|
|
58
|
+
}
|
|
59
|
+
// Bug fixes
|
|
60
|
+
if (entry.changes.fixes.length > 0) {
|
|
61
|
+
changelog += "### 🐛 Bug Fixes\n\n";
|
|
62
|
+
for (const commit of entry.changes.fixes) {
|
|
63
|
+
changelog += formatCommitLine(commit, options) + "\n";
|
|
64
|
+
}
|
|
65
|
+
changelog += "\n";
|
|
66
|
+
}
|
|
67
|
+
// Other changes
|
|
68
|
+
if (entry.changes.other.length > 0) {
|
|
69
|
+
changelog += "### 🔧 Other Changes\n\n";
|
|
70
|
+
for (const commit of entry.changes.other) {
|
|
71
|
+
changelog += formatCommitLine(commit, options) + "\n";
|
|
72
|
+
}
|
|
73
|
+
changelog += "\n";
|
|
74
|
+
}
|
|
75
|
+
return changelog;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Format a single commit line
|
|
79
|
+
*/
|
|
80
|
+
function formatCommitLine(commit, options) {
|
|
81
|
+
let line = "- ";
|
|
82
|
+
// Add scope if available and enabled
|
|
83
|
+
if (options.includeScopes && commit.scope) {
|
|
84
|
+
line += `**${commit.scope}**: `;
|
|
85
|
+
}
|
|
86
|
+
// Add subject
|
|
87
|
+
line += commit.subject;
|
|
88
|
+
// Add hash if enabled
|
|
89
|
+
if (options.includeCommitHashes) {
|
|
90
|
+
line += ` (${commit.hash.substring(0, 7)})`;
|
|
91
|
+
}
|
|
92
|
+
return line;
|
|
93
|
+
}
|
|
94
|
+
/** Update or create a changelog file for a module. */
|
|
95
|
+
export async function updateChangelogFile(moduleResult, changelogContent, repoRoot) {
|
|
96
|
+
const changelogPath = join(repoRoot, moduleResult.path, "CHANGELOG.md");
|
|
97
|
+
try {
|
|
98
|
+
// Try to read existing changelog
|
|
99
|
+
const existingContent = await fs.readFile(changelogPath, "utf8");
|
|
100
|
+
// Insert new content after the first heading
|
|
101
|
+
const lines = existingContent.split("\n");
|
|
102
|
+
let insertIndex = 0;
|
|
103
|
+
// Find the first ## heading or the end of initial content
|
|
104
|
+
for (let i = 0; i < lines.length; i++) {
|
|
105
|
+
if (lines[i].startsWith("## ")) {
|
|
106
|
+
insertIndex = i;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
if (i === 0 && lines[i].startsWith("# ")) {
|
|
110
|
+
// Skip the main heading
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Insert the new changelog entry
|
|
115
|
+
const beforeInsert = lines.slice(0, insertIndex);
|
|
116
|
+
const afterInsert = lines.slice(insertIndex);
|
|
117
|
+
const updatedContent = [
|
|
118
|
+
...beforeInsert,
|
|
119
|
+
changelogContent.trim(),
|
|
120
|
+
"",
|
|
121
|
+
...afterInsert,
|
|
122
|
+
].join("\n");
|
|
123
|
+
await fs.writeFile(changelogPath, updatedContent, "utf8");
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (error instanceof Error &&
|
|
127
|
+
"code" in error &&
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
|
+
error.code === "ENOENT") {
|
|
130
|
+
// Create new changelog file
|
|
131
|
+
const moduleName = moduleResult.id === "root" ? "Root Module" : moduleResult.id;
|
|
132
|
+
const newContent = `# Changelog - ${moduleName}\n\n${changelogContent}`;
|
|
133
|
+
await fs.writeFile(changelogPath, newContent, "utf8");
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return changelogPath;
|
|
140
|
+
}
|
|
141
|
+
/** Generate changelog for multiple modules. */
|
|
142
|
+
export async function generateChangelogsForModules(moduleResults, getCommitsForModule, repoRoot, options) {
|
|
143
|
+
const changelogPaths = [];
|
|
144
|
+
for (const moduleResult of moduleResults) {
|
|
145
|
+
const commits = await getCommitsForModule(moduleResult.id);
|
|
146
|
+
const changelogContent = await generateChangelog(moduleResult, commits, options);
|
|
147
|
+
const changelogPath = await updateChangelogFile(moduleResult, changelogContent, repoRoot);
|
|
148
|
+
changelogPaths.push(changelogPath);
|
|
149
|
+
}
|
|
150
|
+
return changelogPaths;
|
|
151
|
+
}
|
|
152
|
+
/** Generate a root changelog that summarizes all module changes. */
|
|
153
|
+
export async function generateRootChangelog(moduleResults, repoRoot) {
|
|
154
|
+
const rootChangelogPath = join(repoRoot, "CHANGELOG.md");
|
|
155
|
+
const date = new Date().toISOString().split("T")[0];
|
|
156
|
+
let content = `## ${date}\n\n`;
|
|
157
|
+
if (moduleResults.length === 0) {
|
|
158
|
+
content += "No changes in this release.\n\n";
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
content += "### Module Updates\n\n";
|
|
162
|
+
for (const moduleResult of moduleResults) {
|
|
163
|
+
const fromVersion = moduleResult.from;
|
|
164
|
+
const toVersion = moduleResult.to;
|
|
165
|
+
const moduleName = moduleResult.id === "root" ? "Root" : moduleResult.id;
|
|
166
|
+
content += `- **${moduleName}**: ${fromVersion} → ${toVersion}\n`;
|
|
167
|
+
}
|
|
168
|
+
content += "\n";
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const existingContent = await fs.readFile(rootChangelogPath, "utf8");
|
|
172
|
+
const lines = existingContent.split("\n");
|
|
173
|
+
// Find insertion point (after main heading)
|
|
174
|
+
let insertIndex = 0;
|
|
175
|
+
for (let i = 0; i < lines.length; i++) {
|
|
176
|
+
if (lines[i].startsWith("## ") && i > 0) {
|
|
177
|
+
insertIndex = i;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const beforeInsert = lines.slice(0, insertIndex);
|
|
182
|
+
const afterInsert = lines.slice(insertIndex);
|
|
183
|
+
const updatedContent = [
|
|
184
|
+
...beforeInsert,
|
|
185
|
+
content.trim(),
|
|
186
|
+
"",
|
|
187
|
+
...afterInsert,
|
|
188
|
+
].join("\n");
|
|
189
|
+
await fs.writeFile(rootChangelogPath, updatedContent, "utf8");
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (error instanceof Error &&
|
|
193
|
+
"code" in error &&
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
195
|
+
error.code === "ENOENT") {
|
|
196
|
+
const newContent = `# Changelog\n\n${content}`;
|
|
197
|
+
await fs.writeFile(rootChangelogPath, newContent, "utf8");
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return rootChangelogPath;
|
|
204
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BumpType } from "../semver/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema for DependencyRules configuration.
|
|
5
|
+
* Validates that dependency cascade rules use valid bump types.
|
|
6
|
+
*/
|
|
7
|
+
declare const dependencyRulesSchema: z.ZodObject<{
|
|
8
|
+
onMajorOfDependency: z.ZodEnum<{
|
|
9
|
+
major: "major";
|
|
10
|
+
minor: "minor";
|
|
11
|
+
patch: "patch";
|
|
12
|
+
none: "none";
|
|
13
|
+
}>;
|
|
14
|
+
onMinorOfDependency: z.ZodEnum<{
|
|
15
|
+
major: "major";
|
|
16
|
+
minor: "minor";
|
|
17
|
+
patch: "patch";
|
|
18
|
+
none: "none";
|
|
19
|
+
}>;
|
|
20
|
+
onPatchOfDependency: z.ZodEnum<{
|
|
21
|
+
major: "major";
|
|
22
|
+
minor: "minor";
|
|
23
|
+
patch: "patch";
|
|
24
|
+
none: "none";
|
|
25
|
+
}>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/**
|
|
28
|
+
* Zod schema for NodeJSConfig configuration.
|
|
29
|
+
* Validates Node.js-specific settings.
|
|
30
|
+
*/
|
|
31
|
+
declare const nodeJSConfigSchema: z.ZodObject<{
|
|
32
|
+
versionSource: z.ZodArray<z.ZodLiteral<"package.json">>;
|
|
33
|
+
updatePackageLock: z.ZodBoolean;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
/**
|
|
36
|
+
* Zod schema for the main Config object.
|
|
37
|
+
* This schema is used by ConfigurationValidator to ensure type-safe
|
|
38
|
+
* configuration with detailed error messages for invalid configurations.
|
|
39
|
+
*/
|
|
40
|
+
export declare const configSchema: z.ZodObject<{
|
|
41
|
+
defaultBump: z.ZodEnum<{
|
|
42
|
+
major: "major";
|
|
43
|
+
minor: "minor";
|
|
44
|
+
patch: "patch";
|
|
45
|
+
none: "none";
|
|
46
|
+
}>;
|
|
47
|
+
commitTypes: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
48
|
+
major: "major";
|
|
49
|
+
minor: "minor";
|
|
50
|
+
patch: "patch";
|
|
51
|
+
none: "none";
|
|
52
|
+
ignore: "ignore";
|
|
53
|
+
}>>;
|
|
54
|
+
dependencyRules: z.ZodObject<{
|
|
55
|
+
onMajorOfDependency: z.ZodEnum<{
|
|
56
|
+
major: "major";
|
|
57
|
+
minor: "minor";
|
|
58
|
+
patch: "patch";
|
|
59
|
+
none: "none";
|
|
60
|
+
}>;
|
|
61
|
+
onMinorOfDependency: z.ZodEnum<{
|
|
62
|
+
major: "major";
|
|
63
|
+
minor: "minor";
|
|
64
|
+
patch: "patch";
|
|
65
|
+
none: "none";
|
|
66
|
+
}>;
|
|
67
|
+
onPatchOfDependency: z.ZodEnum<{
|
|
68
|
+
major: "major";
|
|
69
|
+
minor: "minor";
|
|
70
|
+
patch: "patch";
|
|
71
|
+
none: "none";
|
|
72
|
+
}>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
nodejs: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
versionSource: z.ZodArray<z.ZodLiteral<"package.json">>;
|
|
76
|
+
updatePackageLock: z.ZodBoolean;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
/**
|
|
80
|
+
* Configuration for μVERSE version bumping behavior.
|
|
81
|
+
* Controls commit type handling, dependency cascade rules, and adapter-specific settings.
|
|
82
|
+
*/
|
|
83
|
+
export type Config = z.infer<typeof configSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Rules for propagating version changes through dependency relationships.
|
|
86
|
+
* Defines how a module should be bumped when its dependencies change.
|
|
87
|
+
*/
|
|
88
|
+
export type DependencyRules = z.infer<typeof dependencyRulesSchema>;
|
|
89
|
+
/**
|
|
90
|
+
* Configuration for Node.js/npm projects.
|
|
91
|
+
*/
|
|
92
|
+
export type NodeJSConfig = z.infer<typeof nodeJSConfigSchema>;
|
|
93
|
+
/**
|
|
94
|
+
* Default μVERSE configuration following Conventional Commits specification.
|
|
95
|
+
* Maps common commit types to semantic version bumps and defines dependency cascade rules.
|
|
96
|
+
*/
|
|
97
|
+
export declare const DEFAULT_CONFIG: Config;
|
|
98
|
+
/**
|
|
99
|
+
* Determines the bump type for a commit based on its type and breaking change flag.
|
|
100
|
+
* @param commitType - The Conventional Commit type (e.g., 'feat', 'fix', 'chore')
|
|
101
|
+
* @param isBreaking - Whether the commit contains breaking changes
|
|
102
|
+
* @param config - Configuration containing commit type mappings
|
|
103
|
+
* @returns The bump type to apply ('major', 'minor', 'patch', or 'none')
|
|
104
|
+
*/
|
|
105
|
+
export declare function getBumpTypeForCommit(commitType: string, isBreaking: boolean, config: Config): BumpType;
|
|
106
|
+
/**
|
|
107
|
+
* Determines how a module should be bumped when one of its dependencies changes.
|
|
108
|
+
* Uses dependency cascade rules from configuration to propagate version changes.
|
|
109
|
+
* @param dependencyBumpType - The bump type applied to the dependency
|
|
110
|
+
* @param config - Configuration containing dependency cascade rules
|
|
111
|
+
* @returns The bump type to apply to the dependent module
|
|
112
|
+
*/
|
|
113
|
+
export declare function getDependencyBumpType(dependencyBumpType: BumpType, config: Config): BumpType;
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves adapter-specific configuration from the main config object.
|
|
116
|
+
* @param config - The main configuration object
|
|
117
|
+
* @param adapterName - The name of the adapter configuration to retrieve
|
|
118
|
+
* @returns The adapter-specific configuration, or undefined if not present
|
|
119
|
+
*/
|
|
120
|
+
export declare function getAdapterConfig<T extends keyof Config>(config: Config, adapterName: T): Config[T];
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAoB9C;;;GAGG;AACH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAIzB,CAAC;AAEH;;;GAGG;AACH,QAAA,MAAM,kBAAkB;;;iBAGtB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKvB,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAmB5B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,MAAM,GACb,QAAQ,CAYV;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,QAAQ,EAC5B,MAAM,EAAE,MAAM,GACb,QAAQ,CAaV;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,MAAM,EACrD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,CAAC,GACb,MAAM,CAAC,CAAC,CAAC,CAEX"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for BumpType values.
|
|
4
|
+
* Used for validation in configuration files.
|
|
5
|
+
*/
|
|
6
|
+
const bumpTypeSchema = z.enum(["major", "minor", "patch", "none"]);
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema for BumpType or 'ignore' values.
|
|
9
|
+
* Used for commit type mappings where 'ignore' is allowed.
|
|
10
|
+
*/
|
|
11
|
+
const bumpTypeOrIgnoreSchema = z.enum([
|
|
12
|
+
"major",
|
|
13
|
+
"minor",
|
|
14
|
+
"patch",
|
|
15
|
+
"none",
|
|
16
|
+
"ignore",
|
|
17
|
+
]);
|
|
18
|
+
/**
|
|
19
|
+
* Zod schema for DependencyRules configuration.
|
|
20
|
+
* Validates that dependency cascade rules use valid bump types.
|
|
21
|
+
*/
|
|
22
|
+
const dependencyRulesSchema = z.object({
|
|
23
|
+
onMajorOfDependency: bumpTypeSchema,
|
|
24
|
+
onMinorOfDependency: bumpTypeSchema,
|
|
25
|
+
onPatchOfDependency: bumpTypeSchema,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Zod schema for NodeJSConfig configuration.
|
|
29
|
+
* Validates Node.js-specific settings.
|
|
30
|
+
*/
|
|
31
|
+
const nodeJSConfigSchema = z.object({
|
|
32
|
+
versionSource: z.array(z.literal("package.json")),
|
|
33
|
+
updatePackageLock: z.boolean(),
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Zod schema for the main Config object.
|
|
37
|
+
* This schema is used by ConfigurationValidator to ensure type-safe
|
|
38
|
+
* configuration with detailed error messages for invalid configurations.
|
|
39
|
+
*/
|
|
40
|
+
export const configSchema = z.object({
|
|
41
|
+
defaultBump: bumpTypeSchema,
|
|
42
|
+
commitTypes: z.record(z.string(), bumpTypeOrIgnoreSchema),
|
|
43
|
+
dependencyRules: dependencyRulesSchema,
|
|
44
|
+
nodejs: nodeJSConfigSchema.optional(),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Default μVERSE configuration following Conventional Commits specification.
|
|
48
|
+
* Maps common commit types to semantic version bumps and defines dependency cascade rules.
|
|
49
|
+
*/
|
|
50
|
+
export const DEFAULT_CONFIG = {
|
|
51
|
+
defaultBump: "patch",
|
|
52
|
+
commitTypes: {
|
|
53
|
+
feat: "minor",
|
|
54
|
+
fix: "patch",
|
|
55
|
+
perf: "patch",
|
|
56
|
+
refactor: "patch",
|
|
57
|
+
docs: "ignore",
|
|
58
|
+
test: "ignore",
|
|
59
|
+
chore: "ignore",
|
|
60
|
+
style: "ignore",
|
|
61
|
+
ci: "ignore",
|
|
62
|
+
build: "ignore",
|
|
63
|
+
},
|
|
64
|
+
dependencyRules: {
|
|
65
|
+
onMajorOfDependency: "major",
|
|
66
|
+
onMinorOfDependency: "minor",
|
|
67
|
+
onPatchOfDependency: "patch",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Determines the bump type for a commit based on its type and breaking change flag.
|
|
72
|
+
* @param commitType - The Conventional Commit type (e.g., 'feat', 'fix', 'chore')
|
|
73
|
+
* @param isBreaking - Whether the commit contains breaking changes
|
|
74
|
+
* @param config - Configuration containing commit type mappings
|
|
75
|
+
* @returns The bump type to apply ('major', 'minor', 'patch', or 'none')
|
|
76
|
+
*/
|
|
77
|
+
export function getBumpTypeForCommit(commitType, isBreaking, config) {
|
|
78
|
+
if (isBreaking) {
|
|
79
|
+
return "major";
|
|
80
|
+
}
|
|
81
|
+
const configuredBump = config.commitTypes[commitType];
|
|
82
|
+
if (configuredBump === "ignore") {
|
|
83
|
+
return "none";
|
|
84
|
+
}
|
|
85
|
+
return configuredBump || config.defaultBump;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Determines how a module should be bumped when one of its dependencies changes.
|
|
89
|
+
* Uses dependency cascade rules from configuration to propagate version changes.
|
|
90
|
+
* @param dependencyBumpType - The bump type applied to the dependency
|
|
91
|
+
* @param config - Configuration containing dependency cascade rules
|
|
92
|
+
* @returns The bump type to apply to the dependent module
|
|
93
|
+
*/
|
|
94
|
+
export function getDependencyBumpType(dependencyBumpType, config) {
|
|
95
|
+
const rules = config.dependencyRules;
|
|
96
|
+
switch (dependencyBumpType) {
|
|
97
|
+
case "major":
|
|
98
|
+
return rules.onMajorOfDependency;
|
|
99
|
+
case "minor":
|
|
100
|
+
return rules.onMinorOfDependency;
|
|
101
|
+
case "patch":
|
|
102
|
+
return rules.onPatchOfDependency;
|
|
103
|
+
default:
|
|
104
|
+
return "none";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves adapter-specific configuration from the main config object.
|
|
109
|
+
* @param config - The main configuration object
|
|
110
|
+
* @param adapterName - The name of the adapter configuration to retrieve
|
|
111
|
+
* @returns The adapter-specific configuration, or undefined if not present
|
|
112
|
+
*/
|
|
113
|
+
export function getAdapterConfig(config, adapterName) {
|
|
114
|
+
return config[adapterName];
|
|
115
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AdapterIdentifierRegistry } from "../services/adapter-identifier-registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates and configures the global adapter identifier registry.
|
|
4
|
+
*
|
|
5
|
+
* @returns Configured {@link AdapterIdentifierRegistry} with all available adapters
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Central point for registering all supported project adapters.
|
|
9
|
+
* To add a new adapter, implement {@link AdapterIdentifier} and add it to the array.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAdapterIdentifierRegistry(): AdapterIdentifierRegistry;
|
|
12
|
+
//# sourceMappingURL=adapter-identifier-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-identifier-registry.d.ts","sourceRoot":"","sources":["../../src/factories/adapter-identifier-registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAEvF;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,IAAI,yBAAyB,CAc3E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GradleAdapterIdentifier } from "../adapters/gradle/services/gradle-adapter-identifier.js";
|
|
2
|
+
import { AdapterIdentifierRegistry } from "../services/adapter-identifier-registry.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates and configures the global adapter identifier registry.
|
|
5
|
+
*
|
|
6
|
+
* @returns Configured {@link AdapterIdentifierRegistry} with all available adapters
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Central point for registering all supported project adapters.
|
|
10
|
+
* To add a new adapter, implement {@link AdapterIdentifier} and add it to the array.
|
|
11
|
+
*/
|
|
12
|
+
export function createAdapterIdentifierRegistry() {
|
|
13
|
+
// Array of all registered adapter identifiers
|
|
14
|
+
// Order matters: first matching adapter is selected during auto-detection
|
|
15
|
+
const identifiers = [
|
|
16
|
+
new GradleAdapterIdentifier(),
|
|
17
|
+
// Add future adapter identifiers here as they are implemented:
|
|
18
|
+
// new MavenAdapterIdentifier(),
|
|
19
|
+
// new NodeJSAdapterIdentifier(),
|
|
20
|
+
// new PythonAdapterIdentifier(),
|
|
21
|
+
];
|
|
22
|
+
// Create and return the registry with all registered identifiers
|
|
23
|
+
return new AdapterIdentifierRegistry(identifiers);
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModuleSystemFactory } from "../services/module-system-factory.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates the appropriate module system factory for a given adapter.
|
|
4
|
+
* @param adapterName - The identifier of the build system adapter (e.g., 'gradle', 'maven', 'npm')
|
|
5
|
+
* @param repoRoot - The absolute path to the repository root directory
|
|
6
|
+
* @returns A ModuleSystemFactory instance configured for the specified adapter
|
|
7
|
+
* @throws {Error} If the adapter name is not recognized or supported
|
|
8
|
+
*/
|
|
9
|
+
export declare function createModuleSystemFactory(adapterName: string, repoRoot: string): ModuleSystemFactory;
|
|
10
|
+
//# sourceMappingURL=module-system-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-system-factory.d.ts","sourceRoot":"","sources":["../../src/factories/module-system-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAI3E;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,mBAAmB,CASrB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GradleModuleSystemFactory } from "../adapters/gradle/services/gradle-module-system-factory.js";
|
|
2
|
+
import { GRADLE_ID } from "../adapters/gradle/constants.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates the appropriate module system factory for a given adapter.
|
|
5
|
+
* @param adapterName - The identifier of the build system adapter (e.g., 'gradle', 'maven', 'npm')
|
|
6
|
+
* @param repoRoot - The absolute path to the repository root directory
|
|
7
|
+
* @returns A ModuleSystemFactory instance configured for the specified adapter
|
|
8
|
+
* @throws {Error} If the adapter name is not recognized or supported
|
|
9
|
+
*/
|
|
10
|
+
export function createModuleSystemFactory(adapterName, repoRoot) {
|
|
11
|
+
// Normalize adapter name to lowercase for case-insensitive matching
|
|
12
|
+
switch (adapterName.toLowerCase()) {
|
|
13
|
+
case GRADLE_ID:
|
|
14
|
+
return new GradleModuleSystemFactory(repoRoot);
|
|
15
|
+
default:
|
|
16
|
+
throw new Error(`Unsupported adapter: ${adapterName}`);
|
|
17
|
+
}
|
|
18
|
+
}
|