express-simplicity
Version:
ExpressSimplicity is a unique and descriptive npm package that revolutionizes Express.js development. This comprehensive toolkit provides an intuitive and streamlined approach to building robust web applications with Express.js.
17 lines (14 loc) • 469 B
JavaScript
import fs from 'fs';
import path from 'path';
const generateFileStructure = (baseDir, structure) => {
Object.entries(structure).forEach(([name, content]) => {
const itemPath = path.join(baseDir, name);
if (typeof content === 'object') {
fs.mkdirSync(itemPath);
generateFileStructure(itemPath, content);
} else if (typeof content === 'string') {
fs.writeFileSync(itemPath, content);
}
});
};
export default generateFileStructure;