@muverse/core 0.2.1 → 0.2.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.
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -101,17 +101,20 @@ async function executeGradleScript(projectRoot, outputFile) {
|
|
|
101
101
|
export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
102
102
|
// Step 1: Check if project-information.json exists
|
|
103
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);
|
|
104
108
|
if (fileExists) {
|
|
105
109
|
// Step 2: File exists, check cache validity
|
|
106
110
|
try {
|
|
107
111
|
const fileContent = await fs.readFile(outputFile, 'utf-8');
|
|
108
112
|
const cachedData = JSON.parse(fileContent);
|
|
109
|
-
// Step 2.1
|
|
110
|
-
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
111
|
-
// Step 2.3 & 2.4: Compare hashes
|
|
113
|
+
// Step 2.1: Compare hashes
|
|
112
114
|
if (cachedData.hash === currentHash) {
|
|
113
|
-
// Cache hit -
|
|
114
|
-
|
|
115
|
+
// Cache hit - use cached data
|
|
116
|
+
executeScript = false;
|
|
117
|
+
data = cachedData.data;
|
|
115
118
|
}
|
|
116
119
|
// Cache miss - hash mismatch, need to regenerate
|
|
117
120
|
}
|
|
@@ -120,26 +123,27 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
|
120
123
|
console.warn(`Failed to read cached project information: ${error}`);
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
|
-
|
|
124
|
-
|
|
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
|
+
}
|
|
125
134
|
// Verify that the output file was created
|
|
126
135
|
const fileExistsAfterExec = await exists(outputFile);
|
|
127
136
|
if (!fileExistsAfterExec) {
|
|
128
137
|
throw new Error(`Expected output file not found at ${outputFile}. ` +
|
|
129
138
|
`Ensure that the Gradle init script is correctly generating the project information.`);
|
|
130
139
|
}
|
|
131
|
-
// Read the output file content
|
|
132
|
-
const projectInformationContent = await fs.readFile(outputFile, 'utf-8');
|
|
133
|
-
// Parse JSON output from Gradle
|
|
134
|
-
const gradleProjectInformation = JSON.parse(projectInformationContent.trim() || '{}');
|
|
135
|
-
// Read gradle.properites and add version
|
|
136
|
-
const projectInformation = await getInformationWithVersions(projectRoot, gradleProjectInformation);
|
|
137
140
|
// Compute hash and save with cache information
|
|
138
|
-
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
139
141
|
const cachedData = {
|
|
140
142
|
hash: currentHash,
|
|
141
|
-
data
|
|
143
|
+
data
|
|
142
144
|
};
|
|
145
|
+
// Read gradle.properites and add version
|
|
146
|
+
const projectInformation = await getInformationWithVersions(projectRoot, data);
|
|
143
147
|
// Write back to file with hash for future cache validation
|
|
144
148
|
await fs.writeFile(outputFile, JSON.stringify(cachedData, null, 2), 'utf-8');
|
|
145
149
|
return projectInformation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muverse/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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",
|