UNPKG

zents-cli

Version:

ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.

24 lines (23 loc) 846 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.copyDir = void 0; const doesDirOrFileExists_1 = require("./doesDirOrFileExists"); const path_1 = require("path"); const fs_1 = require("fs"); async function copyDir(src, dest) { const entries = await fs_1.promises.readdir(src, { withFileTypes: true }); for (const entry of entries) { const srcPath = path_1.join(src, entry.name); const destPath = path_1.join(dest, entry.name); if (entry.isDirectory()) { if (!(await doesDirOrFileExists_1.doesDirOrFileExists(destPath))) { await fs_1.promises.mkdir(destPath); } await copyDir(srcPath, destPath); } else { await fs_1.promises.copyFile(srcPath, destPath); } } } exports.copyDir = copyDir;