@muverse/core 0.2.0 → 0.2.2
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/dist/adapters/gradle/gradle-project-information.d.ts.map +1 -1
- package/dist/adapters/gradle/gradle-project-information.js +45 -13
- package/dist/adapters/gradle/init-project-information.gradle.kts +0 -2
- package/dist/adapters/gradle/services/gradle-version-update-strategy.d.ts.map +1 -1
- package/dist/adapters/project-information.d.ts +8 -4
- package/dist/adapters/project-information.d.ts.map +1 -1
- package/dist/services/verse-runner.d.ts.map +1 -1
- package/dist/services/verse-runner.js +1 -1
- package/dist/utils/properties.d.ts +8 -0
- package/dist/utils/properties.d.ts.map +1 -1
- package/dist/utils/properties.js +32 -0
- package/package.json +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradle-project-information.d.ts","sourceRoot":"","sources":["../../../src/adapters/gradle/gradle-project-information.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"gradle-project-information.d.ts","sourceRoot":"","sources":["../../../src/adapters/gradle/gradle-project-information.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAwH1G;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6DtH;AA2CD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,kBAAkB,CA6CnG"}
|
|
@@ -6,6 +6,7 @@ import { execa } from 'execa';
|
|
|
6
6
|
import fs from 'fs/promises';
|
|
7
7
|
import crypto from 'crypto';
|
|
8
8
|
import fg from 'fast-glob';
|
|
9
|
+
import { parseProperties } from '../../utils/properties.js';
|
|
9
10
|
/**
|
|
10
11
|
* Name of the Gradle wrapper script file.
|
|
11
12
|
* Ensures consistent builds without requiring pre-installed Gradle.
|
|
@@ -100,17 +101,20 @@ async function executeGradleScript(projectRoot, outputFile) {
|
|
|
100
101
|
export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
101
102
|
// Step 1: Check if project-information.json exists
|
|
102
103
|
const fileExists = await exists(outputFile);
|
|
104
|
+
let data = {};
|
|
105
|
+
let executeScript = true;
|
|
106
|
+
// Compute hash of all Gradle build files
|
|
107
|
+
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
103
108
|
if (fileExists) {
|
|
104
109
|
// Step 2: File exists, check cache validity
|
|
105
110
|
try {
|
|
106
111
|
const fileContent = await fs.readFile(outputFile, 'utf-8');
|
|
107
112
|
const cachedData = JSON.parse(fileContent);
|
|
108
|
-
// Step 2.1
|
|
109
|
-
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
110
|
-
// Step 2.3 & 2.4: Compare hashes
|
|
113
|
+
// Step 2.1: Compare hashes
|
|
111
114
|
if (cachedData.hash === currentHash) {
|
|
112
|
-
// Cache hit -
|
|
113
|
-
|
|
115
|
+
// Cache hit - use cached data
|
|
116
|
+
executeScript = false;
|
|
117
|
+
data = cachedData.data;
|
|
114
118
|
}
|
|
115
119
|
// Cache miss - hash mismatch, need to regenerate
|
|
116
120
|
}
|
|
@@ -119,28 +123,56 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
|
119
123
|
console.warn(`Failed to read cached project information: ${error}`);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
if (executeScript) {
|
|
127
|
+
// Step 3: File doesn't exist or cache is invalid - execute Gradle script
|
|
128
|
+
await executeGradleScript(projectRoot, outputFile);
|
|
129
|
+
// Read the output file content
|
|
130
|
+
const fileContent = await fs.readFile(outputFile, 'utf-8');
|
|
131
|
+
// Parse JSON output from Gradle
|
|
132
|
+
data = JSON.parse(fileContent.trim() || '{}');
|
|
133
|
+
}
|
|
124
134
|
// Verify that the output file was created
|
|
125
135
|
const fileExistsAfterExec = await exists(outputFile);
|
|
126
136
|
if (!fileExistsAfterExec) {
|
|
127
137
|
throw new Error(`Expected output file not found at ${outputFile}. ` +
|
|
128
138
|
`Ensure that the Gradle init script is correctly generating the project information.`);
|
|
129
139
|
}
|
|
130
|
-
// Read the output file content
|
|
131
|
-
const projectInformationContent = await fs.readFile(outputFile, 'utf-8');
|
|
132
|
-
// Parse JSON output from Gradle
|
|
133
|
-
const projectInformation = JSON.parse(projectInformationContent.trim() || '{}');
|
|
134
140
|
// Compute hash and save with cache information
|
|
135
|
-
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
136
141
|
const cachedData = {
|
|
137
142
|
hash: currentHash,
|
|
138
|
-
data
|
|
143
|
+
data
|
|
139
144
|
};
|
|
145
|
+
// Read gradle.properites and add version
|
|
146
|
+
const projectInformation = await getInformationWithVersions(projectRoot, data);
|
|
140
147
|
// Write back to file with hash for future cache validation
|
|
141
148
|
await fs.writeFile(outputFile, JSON.stringify(cachedData, null, 2), 'utf-8');
|
|
142
149
|
return projectInformation;
|
|
143
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Reads gradle.properties to extract module versions and augment raw project information.
|
|
153
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
154
|
+
* @param projectInformation - Gradle project information without versions
|
|
155
|
+
* @returns Promise resolving to augmented RawProjectInformation with versions
|
|
156
|
+
*/
|
|
157
|
+
async function getInformationWithVersions(projectRoot, projectInformation) {
|
|
158
|
+
const gradlePropertiesFile = join(projectRoot, 'gradle.properties');
|
|
159
|
+
const gradlePropertiesExists = await exists(gradlePropertiesFile);
|
|
160
|
+
const result = {};
|
|
161
|
+
let moduleVersions = new Map();
|
|
162
|
+
if (gradlePropertiesExists) {
|
|
163
|
+
moduleVersions = await parseProperties(gradlePropertiesFile);
|
|
164
|
+
for (const [moduleId, module] of Object.entries(projectInformation)) {
|
|
165
|
+
const version = moduleVersions.get(module.versionProperty);
|
|
166
|
+
const resultVersion = version ? version : undefined;
|
|
167
|
+
result[moduleId] = {
|
|
168
|
+
...module,
|
|
169
|
+
version: resultVersion,
|
|
170
|
+
declaredVersion: resultVersion !== undefined
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
144
176
|
/**
|
|
145
177
|
* Transforms raw project information into structured, queryable format.
|
|
146
178
|
* Normalizes modules, identifies root, parses versions, and maps dependencies.
|
|
@@ -127,10 +127,8 @@ gradle.rootProject {
|
|
|
127
127
|
mapOf(
|
|
128
128
|
"path" to projectInfo["path"],
|
|
129
129
|
"affectedModules" to affectedModules.toSortedSet(),
|
|
130
|
-
"version" to projectInfo["version"],
|
|
131
130
|
"type" to projectInfo["type"],
|
|
132
131
|
"name" to projectInfo["name"],
|
|
133
|
-
"declaredVersion" to projectInfo["declaredVersion"],
|
|
134
132
|
"versionProperty" to projectInfo["versionProperty"]
|
|
135
133
|
)
|
|
136
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradle-version-update-strategy.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gradle/services/gradle-version-update-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;;GAGG;AACH,qBAAa,2BAA4B,YAAW,qBAAqB;IAQzC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAP7D,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC;;;OAGG;gBACS,QAAQ,EAAE,MAAM,EAAmB,cAAc,EAAE,cAAc;IAI7E;;;;OAIG;IACG,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"gradle-version-update-strategy.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gradle/services/gradle-version-update-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;;GAGG;AACH,qBAAa,2BAA4B,YAAW,qBAAqB;IAQzC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAP7D,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC;;;OAGG;gBACS,QAAQ,EAAE,MAAM,EAAmB,cAAc,EAAE,cAAc;IAI7E;;;;OAIG;IACG,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAe9E"}
|
|
@@ -31,10 +31,9 @@ export type ProjectInformation = {
|
|
|
31
31
|
readonly rootModule: string;
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* Similar to Module but with arrays instead of Sets and optional string version.
|
|
34
|
+
* Base module data structure without the module ID and with version as a string.
|
|
36
35
|
*/
|
|
37
|
-
export type
|
|
36
|
+
export type BaseModule = {
|
|
38
37
|
/** Human-readable name of the module. */
|
|
39
38
|
readonly name: string;
|
|
40
39
|
/** Relative path from repository root to the module directory. */
|
|
@@ -47,7 +46,12 @@ export type RawModule = {
|
|
|
47
46
|
readonly type: "module" | "root";
|
|
48
47
|
/** Whether the version is explicitly declared in build configuration. */
|
|
49
48
|
readonly declaredVersion: boolean;
|
|
50
|
-
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Raw module data as extracted from the build system before processing.
|
|
52
|
+
* Similar to Module but with arrays instead of Sets and optional string version.
|
|
53
|
+
*/
|
|
54
|
+
export type RawModule = BaseModule & Record<string, unknown>;
|
|
51
55
|
/**
|
|
52
56
|
* Raw project structure information as extracted from the build system.
|
|
53
57
|
* Maps module IDs to their raw module data.
|
|
@@ -1 +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,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B;;;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
|
|
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;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repoRoot),
|
|
37
|
-
outputFile: path.resolve(options.outputFile)
|
|
37
|
+
outputFile: path.resolve(options.outputFile),
|
|
38
38
|
};
|
|
39
39
|
// Initialize services
|
|
40
40
|
this.configurationLoader = new ConfigurationLoader(new ConfigurationValidator());
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a generic properties file into key-value pairs
|
|
3
|
+
* Supports both '=' and ':' as delimiters
|
|
4
|
+
* Skips comments (lines starting with # or !) and empty lines
|
|
5
|
+
* @param propertiesPath - Path to the properties file
|
|
6
|
+
* @returns Map of property keys to values
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseProperties(propertiesPath: string): Promise<Map<string, string>>;
|
|
1
9
|
/**
|
|
2
10
|
* Updates or inserts a single property in a Java-style properties file.
|
|
3
11
|
* @param propertiesPath - Path to the properties file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/utils/properties.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAgDf"}
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/utils/properties.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiC9B;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAgDf"}
|
package/dist/utils/properties.js
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
import { promises as fs } from "fs";
|
|
2
2
|
import { exists } from "./file.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parse a generic properties file into key-value pairs
|
|
5
|
+
* Supports both '=' and ':' as delimiters
|
|
6
|
+
* Skips comments (lines starting with # or !) and empty lines
|
|
7
|
+
* @param propertiesPath - Path to the properties file
|
|
8
|
+
* @returns Map of property keys to values
|
|
9
|
+
*/
|
|
10
|
+
export async function parseProperties(propertiesPath) {
|
|
11
|
+
const content = await fs.readFile(propertiesPath, "utf8");
|
|
12
|
+
const properties = new Map();
|
|
13
|
+
// Parse all properties line by line
|
|
14
|
+
const lines = content.split("\n");
|
|
15
|
+
for (const line of lines) {
|
|
16
|
+
const trimmedLine = line.trim();
|
|
17
|
+
// Skip comments and empty lines
|
|
18
|
+
if (trimmedLine.startsWith("#") ||
|
|
19
|
+
trimmedLine.startsWith("!") ||
|
|
20
|
+
!trimmedLine) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
// Parse property: key=value or key:value
|
|
24
|
+
const match = trimmedLine.match(/^([^=:]+)[=:]\s*(.+)$/);
|
|
25
|
+
if (!match) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const [, key, value] = match;
|
|
29
|
+
const trimmedKey = key.trim();
|
|
30
|
+
const trimmedValue = value.trim();
|
|
31
|
+
properties.set(trimmedKey, trimmedValue);
|
|
32
|
+
}
|
|
33
|
+
return properties;
|
|
34
|
+
}
|
|
3
35
|
/**
|
|
4
36
|
* Updates or inserts a single property in a Java-style properties file.
|
|
5
37
|
* @param propertiesPath - Path to the properties file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muverse/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Version Engine for Repo Semantic Evolution (Core Library)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"conventional-commits-parser": "^6.2.1",
|
|
48
48
|
"cosmiconfig": "^9.0.0",
|
|
49
|
-
"crypto": "^1.0.1",
|
|
50
49
|
"deepmerge": "^4.3.1",
|
|
51
50
|
"execa": "^9.6.1",
|
|
52
51
|
"fast-glob": "^3.3.3",
|