[examples] Adjust readmes and info endpoint (#3542)

* Adjust README links

* Change example info

* Fix id check
This commit is contained in:
Andy
2020-01-10 13:37:33 +01:00
committed by GitHub
parent 0c6c6677a7
commit 4625f66ebd
46 changed files with 52 additions and 49 deletions

View File

@@ -44,16 +44,19 @@ export async function getGitHubRepoInfo(repo: Repo) {
branch: repo.branch,
};
const subdirPath = repo.repo + '/tree/' + repo.branch + '/';
const subdirPath =
repo.repo +
'/tree/' +
repo.branch +
'/' +
(data.id === 'zeit/now' ? 'examples/' : '');
if (repo.path.startsWith(subdirPath)) {
// subdir
data.subdir = repo.path.slice(subdirPath.length).split('/');
}
const isExamples = data.id === 'zeit/now-examples' || data.id === 'zeit/now';
if (isExamples && data.subdir) {
if (data.id === 'zeit/now' && data.subdir) {
// from our examples, add `homepage` and `description` fields
const example = data.subdir[0];
const exampleList = await getExampleList();