Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _clearOutputFolder(folder) {
return fs2.rmdir(folder, { recursive: true, force: true }).then(null, function (e) {
// Ignore "No such dir" error, otherwise propagate further
if (e.code === 'ENOENT') {
return null;
}
throw e;
}).then(fs2.mkdir.bind(fs2, folder));
}
const getMain = memoize(path =>
readFile(resolve(path, "package.json"), readFileOpts)(content => {
const { main } = parse(stripBOM(content));
if (!main) throw new Error("No main setting found");
return main;
})
);
const readFileData = function (filename, fileParser, localFilename) {
return readFile(filename, readFileOpts)(code =>
readFileContent(code, filename, fileParser, localFilename)
);
};
deferred.map(fileset.groups, function (group) {
return fs2.mkdir(path.join(folder, group.path), {intermediate: true});
}).then(function () {
def.resolve(fileset);