UNPKG

@softwareventures/maintain-project

Version:

Automatically create and maintain TypeScript projects with standard settings for Software Ventures Limited

40 lines 1.17 kB
import { basename } from "path"; import HostedGitInfo from "hosted-git-info"; export function createGitHost(options) { return { service: "github", user: options?.gitHost?.user ?? options?.npmPackage?.scope ?? "softwareventures", project: options?.gitHost?.project ?? options?.npmPackage?.name ?? basename(options.path) }; } export function gitHostFromUrl(url) { const info = HostedGitInfo.fromUrl(url); if (info?.type === "github") { return { service: "github", user: info.user, project: info.project }; } else { return { service: "unknown", url }; } } function hostedGitInfo(gitHost) { return gitHost.service === "github" ? new HostedGitInfo("github", gitHost.user, undefined, gitHost.project) : undefined; } export function homepageUrl(gitHost) { return hostedGitInfo(gitHost)?.browse(); } export function bugsUrl(gitHost) { return hostedGitInfo(gitHost)?.bugs(); } export function repositoryShortcut(gitHost) { return hostedGitInfo(gitHost)?.shortcut(); } //# sourceMappingURL=git-host.js.map