mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 21:07:46 +00:00
[examples] Fix subdirectory (#3564)
This commit is contained in:
@@ -44,21 +44,16 @@ export async function getGitHubRepoInfo(repo: Repo) {
|
|||||||
branch: repo.branch,
|
branch: repo.branch,
|
||||||
};
|
};
|
||||||
|
|
||||||
const subdirPath =
|
const subdirPath = repo.repo + '/tree/' + repo.branch + '/';
|
||||||
repo.repo +
|
|
||||||
'/tree/' +
|
|
||||||
repo.branch +
|
|
||||||
'/' +
|
|
||||||
(data.id === 'zeit/now' ? 'examples/' : '');
|
|
||||||
|
|
||||||
if (repo.path.startsWith(subdirPath)) {
|
if (repo.path.startsWith(subdirPath)) {
|
||||||
// subdir
|
// subdir
|
||||||
data.subdir = repo.path.slice(subdirPath.length).split('/');
|
data.subdir = repo.path.slice(subdirPath.length).split('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.id === 'zeit/now' && data.subdir) {
|
if (data.id === 'zeit/now' && data.subdir && data.subdir[0] === 'examples') {
|
||||||
// from our examples, add `homepage` and `description` fields
|
// from our examples, add `homepage` and `description` fields
|
||||||
const example = data.subdir[0];
|
const example = data.subdir[1];
|
||||||
const exampleList = await getExampleList();
|
const exampleList = await getExampleList();
|
||||||
|
|
||||||
for (const item of exampleList) {
|
for (const item of exampleList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user