@dbx-tools/core 0.1.10 → 0.1.11

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/project.ts +11 -0
package/package.json CHANGED
@@ -11,11 +11,11 @@
11
11
  "typescript": "^5.9.3"
12
12
  },
13
13
  "dependencies": {
14
- "@dbx-tools/shared-core": "0.1.10"
14
+ "@dbx-tools/shared-core": "0.1.11"
15
15
  },
16
16
  "main": "index.ts",
17
17
  "license": "UNLICENSED",
18
- "version": "0.1.10",
18
+ "version": "0.1.11",
19
19
  "types": "index.ts",
20
20
  "type": "module",
21
21
  "exports": {
package/src/project.ts CHANGED
@@ -287,6 +287,17 @@ export function repositoryUrl(
287
287
  return format === "npm" ? `git+${https.replace(/\.git$/, "")}.git` : https;
288
288
  }
289
289
 
290
+ /**
291
+ * The active npm registry (`npm config get registry`) as a chainable
292
+ * {@link net.UrlBuilder}, or `undefined` when npm is absent or prints no URL.
293
+ * Cached per `cwd` via {@link projectContextCommand}.
294
+ */
295
+ export function npmRegistry(cwd?: string): net.UrlBuilder | undefined {
296
+ const out = projectContextCommand("npm", ["config", "get", "registry"], cwd).output;
297
+ const trimmed = out?.trim();
298
+ return trimmed && trimmed !== "undefined" ? (net.urlBuilder(trimmed) ?? undefined) : undefined;
299
+ }
300
+
290
301
  function readPackageName(pkgPath: string): string | undefined {
291
302
  if (!stat(pkgPath)?.isFile()) return undefined;
292
303
  try {