UNPKG

zaincode

Version:

A modern, user-friendly CLI tool to manage projects, automate tasks, configure remotes, and push files with ease. Built for developers who want a lightweight yet powerful terminal experience.

21 lines (16 loc) 589 B
import path from 'path' import fs from 'fs/promises' export default async function getAllPaths(dir, rootDir = dir, ignoreDirs = []) { let files = [] const entries = await fs.readdir(dir, { withFileTypes: true }) for (let entry of entries) { if (ignoreDirs.includes(entry.name)) continue // skip ignored dirs const fullPath = path.join(dir, entry.name) if (entry.isDirectory()) { files = files.concat(await getAllPaths(fullPath, rootDir, ignoreDirs)) } else { files.push(path.relative(rootDir, fullPath)) } } return files }