mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 21:07:46 +00:00
* Add API for frameworks and examples * Adjust headers * Update frameworks list * Always use latest * Add types * Use now repo for downloading and listing * Use .existsSync * Remove unused packages * Use 307 for redirect * Add examples * Update tsconfig.json Co-Authored-By: Steven <steven@ceriously.com> * Make examples unique * Remove detectors from frameworks API * Use /api instead of Next.js * Install dependencies * Rename project * Change name * Empty * Change name * Update api/tsconfig.json Co-Authored-By: Steven <steven@ceriously.com> * Update examples Co-authored-by: Steven <steven@ceriously.com>
21 lines
551 B
TypeScript
21 lines
551 B
TypeScript
/**
|
|
* Get example list from extracted folder
|
|
*/
|
|
|
|
import { join } from 'path';
|
|
import { lstatSync, existsSync, readdirSync } from 'fs';
|
|
|
|
const exists = (path: string) => existsSync(path);
|
|
const isDotFile = (name: string) => name.startsWith('.');
|
|
const isDirectory = (path: string) => lstatSync(path).isDirectory();
|
|
|
|
export function summary(source: string) {
|
|
if (!exists(source) || !isDirectory(source)) {
|
|
return [];
|
|
}
|
|
|
|
return readdirSync(source)
|
|
.filter(name => !isDotFile(name))
|
|
.filter(name => isDirectory(join(source, name)));
|
|
}
|