mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 12:57:46 +00:00
Follow up to #5928 to remove a few more "now" references and replace with "vercel" where appropriate.
28 lines
866 B
TypeScript
28 lines
866 B
TypeScript
import { extract } from '../_lib/examples/extract';
|
|
import { summary } from '../_lib/examples/summary';
|
|
import { VercelRequest, VercelResponse } from '@vercel/node';
|
|
import { mapOldToNew } from '../_lib/examples/map-old-to-new';
|
|
import { withApiHandler } from '../_lib/util/with-api-handler';
|
|
|
|
export default withApiHandler(async function (
|
|
req: VercelRequest,
|
|
res: VercelResponse
|
|
) {
|
|
await extract('https://github.com/vercel/vercel/archive/master.zip', '/tmp');
|
|
const exampleList = summary('/tmp/vercel-master/examples');
|
|
|
|
const existingExamples = Array.from(exampleList).map(key => ({
|
|
name: key,
|
|
visible: true,
|
|
suggestions: [],
|
|
}));
|
|
|
|
const oldExamples = Object.keys(mapOldToNew).map(key => ({
|
|
name: key,
|
|
visible: false,
|
|
suggestions: mapOldToNew[key],
|
|
}));
|
|
|
|
res.status(200).json([...existingExamples, ...oldExamples]);
|
|
});
|