empty src dir error fix - fixes #7375

This commit is contained in:
Raja Sekar 2018-02-13 11:54:19 +05:30 committed by Logan Smyth
parent 5d615dd198
commit 50b9fbb570
5 changed files with 15 additions and 0 deletions

View File

@ -63,6 +63,13 @@ export default function(commander, filenames, opts) {
return path.join(commander.outDir, filename); return path.join(commander.outDir, filename);
} }
function outputDestFolder(outDir) {
const outDirPath = path.resolve(outDir);
if (!fs.existsSync(outDirPath)) {
fs.mkdirSync(outDirPath);
}
}
function handleFile(src, filename, base, callback) { function handleFile(src, filename, base, callback) {
if (typeof base === "function") { if (typeof base === "function") {
callback = base; callback = base;
@ -82,6 +89,11 @@ export default function(commander, filenames, opts) {
} }
function sequentialHandleFile(files, dirname, index, callback) { function sequentialHandleFile(files, dirname, index, callback) {
if (files.length === 0) {
outputDestFolder(commander.outDir);
return;
}
if (typeof index === "function") { if (typeof index === "function") {
callback = index; callback = index;
index = 0; index = 0;

View File

@ -0,0 +1,3 @@
{
"args": ["src", "--out-dir", "lib"]
}