INNER CODE UNIT · JavaScript
cleanAndCreateFolder
sisense/graphql2rest · src/gqlgenerator/index.js:88
const cleanAndCreateFolder = (targetDirPath) => {
del.sync(targetDirPath);
path.resolve(targetDirPath).split(path.sep).reduce((before, cur) => {
const pathTmp = path.join(before, cur + path.sep);
if (!fs.existsSync(pathTmp)) {
log(`[gqlgenerator] Creating folder ${pathTmp}`);
fs.mkdirSync(pathTmp);
}
return path.join(before, cur + path.sep);
}, '');
};
/**
* Generate the query for the specified field
* @param obj one of the root objects(Query, Mutation, Subscription)
* @param description description of the current object
*/