@openapi-generator-plus/plain-documentation-generator
Version:
An OpenAPI Generator Plus template for generating plain documentation
22 lines (21 loc) • 918 B
JavaScript
;
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));
}
}