UNPKG

@expressots/cli

Version:

Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)

38 lines (37 loc) 1.43 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasFolder = void 0; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); function hasFolder(rootDir, ignoreList = []) { function searchDir(directory) { const files = fs_1.default.readdirSync(directory); for (const file of files) { if (ignoreList.includes(file)) continue; // Skip if the file/folder is in the ignore list const filePath = path_1.default.join(directory, file); const stats = fs_1.default.statSync(filePath); if (stats.isDirectory()) { if (file === "prisma") { return filePath; // Return full path of the 'prisma' folder } else { const result = searchDir(filePath); // Search inside other directories recursively if (result) { return result; } } } } return null; // 'prisma' folder was not found in this directory } const foundPath = searchDir(rootDir); return { found: !!foundPath, path: foundPath, }; } exports.hasFolder = hasFolder;