UNPKG

@openapi-generator-plus/plain-documentation-generator

Version:
22 lines (21 loc) 918 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.copyContents = copyContents; const fs_1 = require("fs"); const path_1 = __importDefault(require("path")); async function copyContents(dirPath, outputPath) { const files = await fs_1.promises.readdir(dirPath); await fs_1.promises.mkdir(outputPath, { recursive: true }); for (const file of files) { const resolvedFile = path_1.default.resolve(dirPath, file); const stat = await fs_1.promises.stat(resolvedFile); if (stat.isDirectory()) { await copyContents(resolvedFile, path_1.default.resolve(outputPath, file)); continue; } await fs_1.promises.copyFile(resolvedFile, path_1.default.resolve(outputPath, file)); } }