[examples] Fix subdirectory (#3564)

This commit is contained in:
Andy
2020-01-10 17:15:22 +01:00
committed by Leo Lamprecht
parent 3fdea52ff9
commit bcbe0d8060

View File

@@ -44,21 +44,16 @@ export async function getGitHubRepoInfo(repo: Repo) {
branch: repo.branch,
};
const subdirPath =
repo.repo +
'/tree/' +
repo.branch +
'/' +
(data.id === 'zeit/now' ? 'examples/' : '');
const subdirPath = repo.repo + '/tree/' + repo.branch + '/';
if (repo.path.startsWith(subdirPath)) {
// subdir
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
const example = data.subdir[0];
const example = data.subdir[1];
const exampleList = await getExampleList();
for (const item of exampleList) {