lib/create-dirs.js
function mkdirSync(dirPath) {
    // Get relative path to output
    const relativePath = dirPath.replace(`${CWD}${pathSep}`, '');
  	const dirs = relativePath.split(pathSep);
  	let currentDir = CWD;

    // Check if each dir exists, and if not, create it
    dirs.forEach(dir => {
      currentDir = path.resolve(currentDir, dir);
      if(!fs.existsSync(currentDir)) {
        fs.mkdirSync(currentDir);
      }
    });
  }
function mkdirSync(dirPath) {
    // Get relative path to output
    const relativePath = dirPath.replace(`${CWD}${pathSep}`, '');
  	const dirs = relativePath.split(pathSep);
  	let currentDir = CWD;

    // Check if each dir exists, and if not, create it
    dirs.forEach(dir => {
      currentDir = path.resolve(currentDir, dir);
      if(!fs.existsSync(currentDir)) {
        fs.mkdirSync(currentDir);
      }
    });
  }
function mkdirSync ( dirPath ) { // Get relative path to output const relativePath = dirPath . replace ( ` ${ CWD } ${ pathSep } ` , '' ) ; const dirs = relativePath . split ( pathSep ) ; let currentDir = CWD ; // Check if each dir exists, and if not, create it dirs . forEach ( dir => { currentDir = path . resolve ( currentDir , dir ) ; if ( ! fs . existsSync ( currentDir ) ) { fs . mkdirSync ( currentDir ) ; } } ) ; }
Synchronous mkdir that handles creating a potentially nested directory
@method mkdirSync
@param {string} dirPath Directory path to create, can be nested
@return {undefined}
Synchronous mkdir that handles creating a potentially nested directory