@releasekit/version 0.5.0 → 0.6.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.
@@ -1146,6 +1146,7 @@ async function calculateVersion(config, options) {
1146
1146
  latestTag,
1147
1147
  name,
1148
1148
  path: pkgPath,
1149
+ commitCheckPath,
1149
1150
  type: optionsType,
1150
1151
  prereleaseIdentifier: optionsPrereleaseIdentifier
1151
1152
  } = options;
@@ -1243,7 +1244,7 @@ async function calculateVersion(config, options) {
1243
1244
  const releaseTypeFromCommits = recommendedBump && "releaseType" in recommendedBump ? recommendedBump.releaseType : void 0;
1244
1245
  const currentVersion = getCurrentVersionFromSource2();
1245
1246
  if (versionSource && versionSource.source === "git") {
1246
- const checkPath = pkgPath || cwd();
1247
+ const checkPath = commitCheckPath || pkgPath || cwd();
1247
1248
  const commitsLength = getCommitsLength(checkPath, versionSource.version);
1248
1249
  if (commitsLength === 0) {
1249
1250
  log(
@@ -1847,6 +1848,7 @@ function createSyncStrategy(config) {
1847
1848
  } = config;
1848
1849
  const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
1849
1850
  let latestTag = await getLatestTag();
1851
+ const repoRoot = packages.root ?? process.cwd();
1850
1852
  let mainPkgPath = packages.root;
1851
1853
  let mainPkgName;
1852
1854
  let versionSourcePath = mainPkgPath;
@@ -1890,6 +1892,7 @@ function createSyncStrategy(config) {
1890
1892
  baseBranch,
1891
1893
  prereleaseIdentifier,
1892
1894
  path: versionSourcePath,
1895
+ commitCheckPath: repoRoot,
1893
1896
  name: versionSourceName,
1894
1897
  type: config.type
1895
1898
  });
@@ -1979,6 +1982,32 @@ function createSyncStrategy(config) {
1979
1982
  ];
1980
1983
  }
1981
1984
  const workspaceNames = updatedPackages.filter((n) => n !== "root");
1985
+ let repoUrl = null;
1986
+ for (const searchPath of [mainPkgPath, versionSourcePath].filter(Boolean)) {
1987
+ try {
1988
+ const pkgJsonPath = path8.join(searchPath, "package.json");
1989
+ if (fs10.existsSync(pkgJsonPath)) {
1990
+ const pkgJson = JSON.parse(fs10.readFileSync(pkgJsonPath, "utf8"));
1991
+ let url;
1992
+ if (typeof pkgJson.repository === "string") {
1993
+ url = pkgJson.repository;
1994
+ } else if (pkgJson.repository?.url) {
1995
+ url = pkgJson.repository.url;
1996
+ }
1997
+ if (url) {
1998
+ if (url.startsWith("git+")) {
1999
+ url = url.slice(4);
2000
+ }
2001
+ if (url.endsWith(".git")) {
2002
+ url = url.slice(0, -4);
2003
+ }
2004
+ repoUrl = url;
2005
+ break;
2006
+ }
2007
+ }
2008
+ } catch {
2009
+ }
2010
+ }
1982
2011
  if (config.packageSpecificTags && workspaceNames.length > 0) {
1983
2012
  for (const pkgName of workspaceNames) {
1984
2013
  addChangelogData({
@@ -1986,7 +2015,7 @@ function createSyncStrategy(config) {
1986
2015
  version: nextVersion,
1987
2016
  previousVersion: latestTag || null,
1988
2017
  revisionRange,
1989
- repoUrl: null,
2018
+ repoUrl,
1990
2019
  entries: changelogEntries
1991
2020
  });
1992
2021
  }
@@ -1996,7 +2025,7 @@ function createSyncStrategy(config) {
1996
2025
  version: nextVersion,
1997
2026
  previousVersion: latestTag || null,
1998
2027
  revisionRange,
1999
- repoUrl: null,
2028
+ repoUrl,
2000
2029
  entries: changelogEntries
2001
2030
  });
2002
2031
  }
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  loadConfig,
6
6
  log,
7
7
  printJsonOutput
8
- } from "./chunk-MRXNAFME.js";
8
+ } from "./chunk-OLXJQCLG.js";
9
9
  import {
10
10
  readPackageVersion
11
11
  } from "./chunk-Q3FHZORY.js";
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  flushPendingWrites,
12
12
  getJsonData,
13
13
  loadConfig
14
- } from "./chunk-MRXNAFME.js";
14
+ } from "./chunk-OLXJQCLG.js";
15
15
  import {
16
16
  BaseVersionError
17
17
  } from "./chunk-Q3FHZORY.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/version",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Semantic versioning based on Git history and conventional commits",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",