UNPKG

@gobvoz/cli-fsd

Version:

Utility to create slices in Feature-Sliced Design methodology. Expect, that you have already installed `react`, `typescript`, `@reduxjs/toolkit`, `@reduxjs/toolkit-query`, `i18n` and use `module.scss` structure.

19 lines (15 loc) 463 B
import fs from 'fs/promises'; import { existsSync as folderExist } from 'fs'; import log from '../utils/log.js'; const createFolder = async (folderPath, silentMode) => { try { if (!folderExist(folderPath)) { !silentMode && log.info(`Creating "${folderPath}" directory`); await fs.mkdir(folderPath); } } catch (error) { log.error(`Could not create "${folderPath}" directory`); process.exit(); } }; export default createFolder;