From 35624835875296967fbab37d317baa16b7c21e1c Mon Sep 17 00:00:00 2001 From: Konneka Date: Fri, 18 Feb 2022 13:44:31 +0300 Subject: [PATCH] fix mkdirp --- helpers/mkdirp.js | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/helpers/mkdirp.js b/helpers/mkdirp.js index 7b7ce1f..9595ad2 100644 --- a/helpers/mkdirp.js +++ b/helpers/mkdirp.js @@ -1,37 +1,12 @@ import mkdirp from 'mkdirp'; import _ from 'lodash'; -import deasync from 'deasync'; - -const mkdirParentsPath = (filePath) => new Promise(async (resolve, reject) =>{ - const folderFileIn = "/" + _.initial(filePath.split("/")).join("/"); - await mkdirp(folderFileIn).catch(reject); - resolve(true); -}); const mkdirParentsPathSync = (filePath) => { - let done = false; - let err; - let result; - - mkdirParentsPath(filePath).then(res => { - result = res; - done = true; - }) - .catch(e => { // eslint-disable-line no-unused-vars - err = e; - done = true; // eslint-disable-line no-unused-vars }); - }); - deasync.loopWhile(function(){return !done;}); - - if (err) { - throw err; - } else { - return result; - } + const folderFileIn = ("/" + _.initial(filePath.split("/")).join("/")).replace(/\/\//g, "/"); + mkdirp.sync(folderFileIn) }; export { - mkdirParentsPath as default, - mkdirParentsPath, + mkdirParentsPathSync as default, mkdirParentsPathSync } \ No newline at end of file