@muverse/core 0.3.0 → 0.3.1

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":"index.d.ts","sourceRoot":"","sources":["../../src/changelog/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAIrD,sDAAsD;AACtD,wBAAsB,mBAAmB,CACvC,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC,CAWf;AAsBD,+CAA+C;AAC/C,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,kBAAkB,EAAE,EACnC,mBAAmB,EAAE,CACnB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EAC3D,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAgEnB;AAED,oEAAoE;AACpE,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,kBAAkB,EAAE,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA4DjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/changelog/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAKrD,sDAAsD;AACtD,wBAAsB,mBAAmB,CACvC,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC,CAWf;AAsBD,+CAA+C;AAC/C,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,kBAAkB,EAAE,EACnC,mBAAmB,EAAE,CACnB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EAC3D,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAiFnB;AAED,oEAAoE;AACpE,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,kBAAkB,EAAE,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA4DjB"}
@@ -4,6 +4,7 @@ import { writeChangelogString } from "conventional-changelog-writer";
4
4
  import { logger } from "../utils/logger.js";
5
5
  import { exists } from "../utils/file.js";
6
6
  import { getCurrentRepoUrl, parseRepoUrl } from "../git/index.js";
7
+ import { isReleaseVersion } from "../semver/index.js";
7
8
  /** Update or create a changelog file for a module. */
8
9
  export async function updateChangelogFile(changelogContent, changelogPath, prependPlaceholder) {
9
10
  let fileContent = changelogContent;
@@ -11,7 +12,7 @@ export async function updateChangelogFile(changelogContent, changelogPath, prepe
11
12
  logger.info(`Updating existing changelog at ${changelogPath}...`);
12
13
  // Try to read existing changelog
13
14
  const existingContent = await fs.readFile(changelogPath, "utf8");
14
- const newContent = prependPlaceholder + "\n\n" + changelogContent;
15
+ const newContent = `${prependPlaceholder}\n\n${changelogContent.trimEnd()}`;
15
16
  fileContent = existingContent.replace(prependPlaceholder, newContent);
16
17
  }
17
18
  await fs.writeFile(changelogPath, fileContent, "utf8");
@@ -41,6 +42,10 @@ export async function generateChangelogsForModules(moduleResults, getCommitsForM
41
42
  }
42
43
  const contextRepository = await buildContextRepository({ cwd: repoRoot });
43
44
  for (const moduleResult of moduleResults) {
45
+ if (!moduleResult.declaredVersion) {
46
+ logger.info(`Module ${moduleResult.id} has no declared version, skipping changelog generation...`);
47
+ continue;
48
+ }
44
49
  const { commits, lastTag } = await getCommitsForModule(moduleResult.id);
45
50
  if (commits.length === 0) {
46
51
  logger.info(`No commits to include in changelog for module ${moduleResult.id}, skipping...`);
@@ -51,8 +56,17 @@ export async function generateChangelogsForModules(moduleResults, getCommitsForM
51
56
  if (await exists(changelogPath)) {
52
57
  prepend = false;
53
58
  }
59
+ const isRelease = isReleaseVersion(moduleResult.to);
60
+ const version = isRelease ? moduleResult.to : undefined;
61
+ const currentTag = isRelease
62
+ ? `${moduleResult.name}@${moduleResult.to}`
63
+ : undefined;
64
+ const previousTag = lastTag || undefined;
54
65
  const changelogContent = await writeChangelogString(commits, {
55
- lastTag: lastTag || undefined,
66
+ version: version,
67
+ previousTag: previousTag,
68
+ currentTag: currentTag,
69
+ linkCompare: previousTag && currentTag ? true : false,
56
70
  ...contextRepository,
57
71
  ...userConfig.context,
58
72
  prepend,
@@ -82,4 +82,5 @@ export declare function addBuildMetadata(version: SemVer, buildMetadata: string)
82
82
  * @returns A prerelease identifier string (e.g., 'alpha.20230515.1430')
83
83
  */
84
84
  export declare function generateTimestampPrereleaseId(baseId: string, timestamp?: Date): string;
85
+ export declare function isReleaseVersion(version: SemVer | string): boolean;
85
86
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/semver/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1D;A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AG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAatE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,QAAQ,CAc9D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAM3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAkDR;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,MAAM,CAMR;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,IAAI,GACf,MAAM,CAeR;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CASlE"}
@@ -174,3 +174,13 @@ export function generateTimestampPrereleaseId(baseId, timestamp) {
174
174
  const timeString = `${hours}${minutes}`;
175
175
  return `${baseId}.${dateString}.${timeString}`;
176
176
  }
177
+ export function isReleaseVersion(version) {
178
+ if (typeof version === "string") {
179
+ const parsed = semver.parse(version);
180
+ if (!parsed)
181
+ return false;
182
+ version = parsed;
183
+ }
184
+ // A release version has no prerelease identifiers
185
+ return version.prerelease.length === 0;
186
+ }
@@ -11,10 +11,10 @@ export class ChangelogGenerator {
11
11
  return [];
12
12
  }
13
13
  logger.info("📚 Generating changelogs...");
14
- if (this.options.dryRun) {
15
- logger.info("🏃‍♂️ Dry run mode - changelogs will not be written to files");
16
- return [];
17
- }
14
+ /*if (this.options.dryRun) {
15
+ logger.info("🏃‍♂️ Dry run mode - changelogs will not be written to files");
16
+ return [];
17
+ }*/
18
18
  // Generate individual module changelogs
19
19
  const changelogPaths = await generateChangelogsForModules(moduleResults, async (moduleId) => moduleCommits.get(moduleId) || { commits: [], lastTag: null }, this.options.repoRoot);
20
20
  /*// Generate root changelog
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "0.3.0";
1
+ export declare const VERSION = "0.3.1";
2
2
  export declare const PACKAGE_NAME = "@muverse/core";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Run 'npm run generate-version' to update this file.
3
- export const VERSION = "0.3.0";
3
+ export const VERSION = "0.3.1";
4
4
  export const PACKAGE_NAME = "@muverse/core";
@@ -5,4 +5,5 @@
5
5
  * @returns Version string with '-SNAPSHOT' suffix
6
6
  */
7
7
  export declare function applySnapshotSuffix(version: string): string;
8
+ export declare function isSnapshotVersion(version: string): boolean;
8
9
  //# sourceMappingURL=versioning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../../src/utils/versioning.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAS3D"}
1
+ {"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../../src/utils/versioning.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAS3D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -15,3 +15,6 @@ export function applySnapshotSuffix(version) {
15
15
  // Append the snapshot suffix to mark this as a development version
16
16
  return `${version}${SNAPSHOT_SUFFIX}`;
17
17
  }
18
+ export function isSnapshotVersion(version) {
19
+ return version.endsWith(SNAPSHOT_SUFFIX);
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muverse/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Version Engine for Repo Semantic Evolution (Core Library)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",