mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* Move defineInterface to shared * Split up utils into node and browser utils * Move defineDisplay to shared * Move defineLayout to shared * Move defineModule to shared * Add defineEndpoint and defineHook to define-extensions * Expose define extension functions through extension-sdk * Make route type of defineEndpoint more specific * Simplify define extension functions * Deduplicate types and local types definition * Do not allow functional components in display handler * Make interface options nullable * Deduplicate extension types definition * Fix utils/node exports
21 lines
455 B
TypeScript
21 lines
455 B
TypeScript
import path from 'path';
|
|
import fse from 'fs-extra';
|
|
|
|
export async function listFolders(location: string): Promise<string[]> {
|
|
const fullPath = path.resolve(location);
|
|
const files = await fse.readdir(fullPath);
|
|
|
|
const directories: string[] = [];
|
|
|
|
for (const file of files) {
|
|
const filePath = path.join(fullPath, file);
|
|
const stats = await fse.stat(filePath);
|
|
|
|
if (stats.isDirectory()) {
|
|
directories.push(file);
|
|
}
|
|
}
|
|
|
|
return directories;
|
|
}
|