packageRepositoryUrl
Generated reference page for the packageRepositoryUrl function export.
- Import:
@kjanat/dreamcli - Export kind: function
- Declared in:
src/core/config/package-json.ts - Source link:
src/core/config/package-json.ts:273
Signatures
ts
function packageRepositoryUrl(pkg: PackageJsonData): string | undefined;Members
Members
packageRepositoryUrl
Resolve a package's repository field to a browsable https:// URL.
Handles the locator formats npm accepts:
- object form:
{ "type": "git", "url": "git+https://github.com/u/r.git" } https/git/sshURLs (git+prefix and.gitsuffix stripped)- scp-style locators:
git@github.com:u/r.git - shorthands:
github:u/r,gitlab:u/r,bitbucket:u/r, and bareu/r(GitHub, per npm convention)
Returns undefined when the field is absent or unrecognised.
ts
(pkg: PackageJsonData): string | undefined;Examples
ts
packageRepositoryUrl({ repository: 'git+https://github.com/u/r.git' });
// 'https://github.com/u/r'