[examples] Add manifest.json

This commit is contained in:
Andy Bitz
2020-01-09 17:24:54 +01:00
parent 4930028674
commit b7eca1d069
2 changed files with 361 additions and 17 deletions

View File

@@ -1,21 +1,10 @@
// Currently we read & parse the README file from zeit/now-examples
// TODO: create a `manifest.json` for zeit/now-examples
import { join } from 'path';
import { readFileSync } from 'fs';
import fetch from 'node-fetch';
const manifest = readFileSync(
join('..', '..', '..', 'examples', 'manifest.json')
);
/**
* Fetch and parse the `Frameworks and Libraries` table
* in the README file of zeit/now-examples
*/
export async function getExampleList() {
const response = await fetch(
`https://raw.githubusercontent.com/zeit/now-examples/master/manifest.json`
);
if (response.status !== 200) {
console.log('manifest.json missing in zeit/now-examples');
return null;
}
return response.json();
return manifest;
}