Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function getRepoInfo(remote, dir) {
const remoteOriginalUrl = getRemoteOriginUrl(remote, dir);
const { owner, name, repo, branch } = gh(remoteOriginalUrl);
const url = `https://github.com/${repo}`;
return {
owner, // "algolia"
name, // "shipjs"
repo, // "algolia/shipjs"
branch, // "master"
url, // "https://github.com/algolia/shipjs"
};
}
throw new Error(
'Could not find scm settings in pom.xml. Make sure you set one up that points to your project on GitHub or set owner+repo in your .autorc'
);
}
const github = arrayify(pom.pomObject.project.scm).find(remote =>
Boolean(remote.url.includes('github'))
);
if (!github) {
throw new Error(
'Could not find GitHub scm settings in pom.xml. Make sure you set one up that points to your project on GitHub or set owner+repo in your .autorc'
);
}
const repoInfo = parseGitHubUrl(github.url);
if (!repoInfo || !repoInfo.owner || !repoInfo.name) {
throw new Error(
'Cannot read owner and project name from GitHub URL in pom.xml'
);
}
return {
owner: repoInfo.owner,
repo: repoInfo.name
};
});
public renderItem(brick: any) {
const started = moment((brick.dateCreated as any) * 1000).fromNow();
const expireLabel = ((brick.expired as any) * 1000 > new Date().getTime()) ? ' Expires ' : ' Expired ';
let expired = brick.expired > 0 ? moment((brick.expired as any) * 1000).fromNow() : '';
expired = expired ? (" • " + expireLabel + expired) : "";
const detailUrl = "/brick/" + brick.id;
const desc = "Status " + BrickStatus[brick.status] + " • " + "Opened "
+ started + expired;
let avatar;
const uriObj = parser(brick.url);
if (uriObj && uriObj.owner && uriObj.host === 'github.com') {
const src = "https://avatars.githubusercontent.com/" + uriObj.owner;
avatar = ;
}
return (
{brick.value} ETH <i>
}
>
{brick.title}}
description={desc}</i>
function parseGithubURL (url) {
let parsed = ParseGithubURL(url)
if (parsed && parsed.host === 'github.com' && parsed.owner && parsed.name) {
let { owner, name } = parsed
return { valid: true, owner, name }
}
return { valid: false }
}
function parseGithubURL(url) {
const parsed = ParseGithubURL(url);
if (parsed && parsed.host === 'github.com' && parsed.owner && parsed.name) {
return parsed;
}
return null;
}
<p style="{{">
{t('知源・致远')}
</p>
,
);
}
if (showGithubStars) {
const githubObj = gh(githubUrl);
if (githubObj && githubObj.owner && githubObj.name) {
renderButtons.push(
<div>
</div>,
);
}
}
return (
<section style="{style}"></section>
function getTemplateRepositoryTarInformation(template: Template): TemplateRepositoryTarInformation {
const meta = github(template.repo.uri)
const uri = [`https://api.github.com/repos`, meta.repo, 'tarball', template.repo.branch].join('/')
return { uri, files: template.repo.path }
}