@muverse/core 0.2.4 → 0.2.6

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;AA4H1G;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAgEtH;AA2CD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,kBAAkB,CA6CnG"}
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;AA4H1G;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsEtH;AA2CD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,kBAAkB,CA6CnG"}
@@ -22,7 +22,7 @@ const GRADLE_INIT_SCRIPT = './init-project-information.gradle.kts';
22
22
  * Finds all Gradle build files recursively under the project root.
23
23
  * Searches for settings.gradle, settings.gradle.kts, build.gradle, and build.gradle.kts files.
24
24
  * @param projectRoot - Absolute path to the Gradle project root directory
25
- * @returns Promise resolving to array of absolute paths to Gradle build files
25
+ * @returns Promise resolving to array of relative paths to Gradle build files
26
26
  */
27
27
  async function findGradleFiles(projectRoot) {
28
28
  const patterns = [
@@ -33,7 +33,7 @@ async function findGradleFiles(projectRoot) {
33
33
  ];
34
34
  const files = await fg(patterns, {
35
35
  cwd: projectRoot,
36
- absolute: true,
36
+ absolute: false,
37
37
  ignore: ['**/node_modules/**', '**/build/**', '**/.gradle/**']
38
38
  });
39
39
  // Sort for consistent ordering
@@ -49,7 +49,7 @@ async function computeGradleFilesHash(projectRoot) {
49
49
  const files = await findGradleFiles(projectRoot);
50
50
  const hash = crypto.createHash('sha256');
51
51
  for (const file of files) {
52
- const content = await fs.readFile(file, 'utf-8');
52
+ const content = await fs.readFile(join(projectRoot, file), 'utf-8');
53
53
  hash.update(file); // Include file path for uniqueness
54
54
  hash.update(content);
55
55
  }
@@ -108,6 +108,7 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
108
108
  let executeScript = true;
109
109
  // Compute hash of all Gradle build files
110
110
  const currentHash = await computeGradleFilesHash(projectRoot);
111
+ logger.info(`🔍 Computed Gradle files hash: ${currentHash}`);
111
112
  if (fileExists) {
112
113
  logger.info(`💾 Cached project information found at ${outputFile}. Validating cache...`);
113
114
  // Step 2: File exists, check cache validity
@@ -116,10 +117,15 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
116
117
  const cachedData = JSON.parse(fileContent);
117
118
  // Step 2.1: Compare hashes
118
119
  if (cachedData.hash === currentHash) {
120
+ logger.info(`✅ Cache is valid. Using cached project information.`);
119
121
  // Cache hit - use cached data
120
122
  executeScript = false;
121
123
  data = cachedData.data;
122
124
  }
125
+ else {
126
+ logger.info(`❌ Cache is invalid. Cached hash: ${cachedData.hash}`);
127
+ logger.info(`🔄 Gradle files changed, regenerating project information...`);
128
+ }
123
129
  // Cache miss - hash mismatch, need to regenerate
124
130
  }
125
131
  catch (error) {
@@ -129,6 +135,7 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
129
135
  }
130
136
  if (executeScript) {
131
137
  // Step 3: File doesn't exist or cache is invalid - execute Gradle script
138
+ const outputFile = join(projectRoot, 'build', 'project-information.json');
132
139
  await executeGradleScript(projectRoot, outputFile);
133
140
  // Read the output file content
134
141
  const fileContent = await fs.readFile(outputFile, 'utf-8');
@@ -148,7 +155,7 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
148
155
  };
149
156
  // Read gradle.properites and add version
150
157
  const projectInformation = await getInformationWithVersions(projectRoot, data);
151
- if (!executeScript) {
158
+ if (executeScript) {
152
159
  // Write back to file with hash for future cache validation
153
160
  await fs.writeFile(outputFile, JSON.stringify(cachedData, null, 2), 'utf-8');
154
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muverse/core",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Version Engine for Repo Semantic Evolution (Core Library)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",