package-versioner 0.6.2 → 0.6.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.
package/dist/index.cjs CHANGED
@@ -710,14 +710,14 @@ async function calculateVersion(config, options) {
710
710
  }
711
711
  const cleanedTag = import_semver2.default.clean(latestTag) || latestTag;
712
712
  const currentVersion = import_semver2.default.clean(cleanedTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
713
- if (STANDARD_BUMP_TYPES.includes(specifiedType) && import_semver2.default.prerelease(currentVersion)) {
713
+ if (STANDARD_BUMP_TYPES.includes(specifiedType) && (import_semver2.default.prerelease(currentVersion) || normalizedPrereleaseId)) {
714
714
  log(
715
- `Cleaning prerelease identifier from ${currentVersion} for ${specifiedType} bump`,
715
+ normalizedPrereleaseId ? `Creating prerelease version with identifier '${normalizedPrereleaseId}' using ${specifiedType}` : `Cleaning prerelease identifier from ${currentVersion} for ${specifiedType} bump`,
716
716
  "debug"
717
717
  );
718
718
  return bumpVersion(currentVersion, specifiedType, normalizedPrereleaseId);
719
719
  }
720
- return import_semver2.default.inc(currentVersion, specifiedType, normalizedPrereleaseId) || "";
720
+ return bumpVersion(currentVersion, specifiedType, normalizedPrereleaseId);
721
721
  }
722
722
  if (branchPattern && branchPattern.length > 0) {
723
723
  const currentBranch = getCurrentBranch();
@@ -751,7 +751,7 @@ async function calculateVersion(config, options) {
751
751
  const cleanedTag = import_semver2.default.clean(latestTag) || latestTag;
752
752
  const currentVersion = import_semver2.default.clean(cleanedTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
753
753
  log(`Applying ${branchVersionType} bump based on branch pattern`, "debug");
754
- return import_semver2.default.inc(currentVersion, branchVersionType, void 0) || "";
754
+ return bumpVersion(currentVersion, branchVersionType, normalizedPrereleaseId);
755
755
  }
756
756
  }
757
757
  try {
@@ -788,7 +788,7 @@ async function calculateVersion(config, options) {
788
788
  return "";
789
789
  }
790
790
  const currentVersion = import_semver2.default.clean(latestTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
791
- return import_semver2.default.inc(currentVersion, releaseTypeFromCommits, normalizedPrereleaseId) || "";
791
+ return bumpVersion(currentVersion, releaseTypeFromCommits, normalizedPrereleaseId);
792
792
  } catch (error) {
793
793
  log(`Failed to calculate version for ${name || "project"}`, "error");
794
794
  console.error(error);
@@ -832,11 +832,15 @@ function calculateNextVersion(version, manifestType, name, releaseType, prerelea
832
832
  `No tags found for ${name || "package"}, using ${manifestType} version: ${version} as base`,
833
833
  "info"
834
834
  );
835
- if (STANDARD_BUMP_TYPES.includes(releaseType) && import_semver2.default.prerelease(version)) {
836
- log(`Cleaning prerelease identifier from ${version} for ${releaseType} bump`, "debug");
835
+ if (STANDARD_BUMP_TYPES.includes(releaseType) && (import_semver2.default.prerelease(version) || prereleaseIdentifier)) {
836
+ log(
837
+ prereleaseIdentifier ? `Creating prerelease version with identifier '${prereleaseIdentifier}' using ${releaseType}` : `Cleaning prerelease identifier from ${version} for ${releaseType} bump`,
838
+ "debug"
839
+ );
837
840
  return bumpVersion(version, releaseType, prereleaseIdentifier);
838
841
  }
839
- return import_semver2.default.inc(version, releaseType, prereleaseIdentifier) || initialVersion;
842
+ const result = bumpVersion(version, releaseType, prereleaseIdentifier);
843
+ return result || initialVersion;
840
844
  }
841
845
 
842
846
  // src/package/packageProcessor.ts
package/dist/index.js CHANGED
@@ -675,14 +675,14 @@ async function calculateVersion(config, options) {
675
675
  }
676
676
  const cleanedTag = semver2.clean(latestTag) || latestTag;
677
677
  const currentVersion = semver2.clean(cleanedTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
678
- if (STANDARD_BUMP_TYPES.includes(specifiedType) && semver2.prerelease(currentVersion)) {
678
+ if (STANDARD_BUMP_TYPES.includes(specifiedType) && (semver2.prerelease(currentVersion) || normalizedPrereleaseId)) {
679
679
  log(
680
- `Cleaning prerelease identifier from ${currentVersion} for ${specifiedType} bump`,
680
+ normalizedPrereleaseId ? `Creating prerelease version with identifier '${normalizedPrereleaseId}' using ${specifiedType}` : `Cleaning prerelease identifier from ${currentVersion} for ${specifiedType} bump`,
681
681
  "debug"
682
682
  );
683
683
  return bumpVersion(currentVersion, specifiedType, normalizedPrereleaseId);
684
684
  }
685
- return semver2.inc(currentVersion, specifiedType, normalizedPrereleaseId) || "";
685
+ return bumpVersion(currentVersion, specifiedType, normalizedPrereleaseId);
686
686
  }
687
687
  if (branchPattern && branchPattern.length > 0) {
688
688
  const currentBranch = getCurrentBranch();
@@ -716,7 +716,7 @@ async function calculateVersion(config, options) {
716
716
  const cleanedTag = semver2.clean(latestTag) || latestTag;
717
717
  const currentVersion = semver2.clean(cleanedTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
718
718
  log(`Applying ${branchVersionType} bump based on branch pattern`, "debug");
719
- return semver2.inc(currentVersion, branchVersionType, void 0) || "";
719
+ return bumpVersion(currentVersion, branchVersionType, normalizedPrereleaseId);
720
720
  }
721
721
  }
722
722
  try {
@@ -753,7 +753,7 @@ async function calculateVersion(config, options) {
753
753
  return "";
754
754
  }
755
755
  const currentVersion = semver2.clean(latestTag.replace(new RegExp(`^${escapedTagPattern}`), "")) || "0.0.0";
756
- return semver2.inc(currentVersion, releaseTypeFromCommits, normalizedPrereleaseId) || "";
756
+ return bumpVersion(currentVersion, releaseTypeFromCommits, normalizedPrereleaseId);
757
757
  } catch (error) {
758
758
  log(`Failed to calculate version for ${name || "project"}`, "error");
759
759
  console.error(error);
@@ -797,11 +797,15 @@ function calculateNextVersion(version, manifestType, name, releaseType, prerelea
797
797
  `No tags found for ${name || "package"}, using ${manifestType} version: ${version} as base`,
798
798
  "info"
799
799
  );
800
- if (STANDARD_BUMP_TYPES.includes(releaseType) && semver2.prerelease(version)) {
801
- log(`Cleaning prerelease identifier from ${version} for ${releaseType} bump`, "debug");
800
+ if (STANDARD_BUMP_TYPES.includes(releaseType) && (semver2.prerelease(version) || prereleaseIdentifier)) {
801
+ log(
802
+ prereleaseIdentifier ? `Creating prerelease version with identifier '${prereleaseIdentifier}' using ${releaseType}` : `Cleaning prerelease identifier from ${version} for ${releaseType} bump`,
803
+ "debug"
804
+ );
802
805
  return bumpVersion(version, releaseType, prereleaseIdentifier);
803
806
  }
804
- return semver2.inc(version, releaseType, prereleaseIdentifier) || initialVersion;
807
+ const result = bumpVersion(version, releaseType, prereleaseIdentifier);
808
+ return result || initialVersion;
805
809
  }
806
810
 
807
811
  // src/package/packageProcessor.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "package-versioner",
3
3
  "description": "A lightweight yet powerful CLI tool for automated semantic versioning based on Git history and conventional commits.",
4
- "version": "0.6.2",
4
+ "version": "0.6.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",