本文整理汇总了TypeScript中hosted-git-info.fromUrl函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fromUrl函数的具体用法?TypeScript fromUrl怎么用?TypeScript fromUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fromUrl函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseRepositoryUrl
function parseRepositoryUrl(url: string): Info {
const info: any = fromUrl(url)
if (info != null) {
delete info.protocols
delete info.treepath
delete info.filetemplate
delete info.bugstemplate
delete info.gittemplate
delete info.tarballtemplate
delete info.sshtemplate
delete info.sshurltemplate
delete info.browsetemplate
delete info.docstemplate
delete info.httpstemplate
delete info.shortcuttemplate
delete info.pathtemplate
delete info.pathmatch
delete info.protocols_re
delete info.committish
delete info.default
delete info.opts
delete info.browsefiletemplate
delete info.auth
}
return info
}
示例2: _getInfo
async function _getInfo(metadata?: AppMetadata, devMetadata?: Metadata): Promise<RepositorySlug | null> {
const repo = metadata == null ? null : (devMetadata!.repository || metadata!.repository)
if (repo == null) {
let url = process.env.TRAVIS_REPO_SLUG
if (url == null) {
const user: string | null = process.env.APPVEYOR_ACCOUNT_NAME || process.env.CIRCLE_PROJECT_USERNAME
const project: string | null = process.env.APPVEYOR_PROJECT_NAME || process.env.CIRCLE_PROJECT_REPONAME
if (user != null && project != null) {
return {
user: user,
project: project,
}
}
url = await getGitUrlFromGitConfig()
}
if (url != null) {
return parseRepositoryUrl(url)
}
}
else {
return parseRepositoryUrl(typeof repo === "string" ? repo : repo.url)
}
return null
}
示例3: getInfo
async function getInfo(provider: ProjectMetadataProvider): Promise<RepositorySlug> {
const repo = provider.devMetadata.repository || provider.metadata.repository
if (repo == null) {
let url = process.env.TRAVIS_REPO_SLUG
if (url == null) {
const user: string = process.env.APPVEYOR_ACCOUNT_NAME || process.env.CIRCLE_PROJECT_USERNAME
const project: string = process.env.APPVEYOR_PROJECT_NAME || process.env.CIRCLE_PROJECT_REPONAME
if (user != null && project != null) {
return {
user: user,
project: project,
}
}
url = await getGitUrlFromGitConfig()
}
if (url != null) {
return parseRepositoryUrl(url)
}
}
else {
return parseRepositoryUrl(typeof repo === "string" ? repo : repo.url)
}
return null
}