zaincode_terminal
Version:
A Git-like Node.js terminal tool that provides an interactive CLI experience with support for custom commands, colors, and automation. Built with chalk, axios, and node-pty for developers who want a modern, lightweight, and powerful command-line utility.
21 lines (16 loc) • 589 B
JavaScript
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
}