empty src dir error fix - fixes #7375
This commit is contained in:
parent
5d615dd198
commit
50b9fbb570
@ -63,6 +63,13 @@ export default function(commander, filenames, opts) {
|
||||
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) {
|
||||
if (typeof base === "function") {
|
||||
callback = base;
|
||||
@ -82,6 +89,11 @@ export default function(commander, filenames, opts) {
|
||||
}
|
||||
|
||||
function sequentialHandleFile(files, dirname, index, callback) {
|
||||
if (files.length === 0) {
|
||||
outputDestFolder(commander.outDir);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof index === "function") {
|
||||
callback = index;
|
||||
index = 0;
|
||||
|
||||
0
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/in-files/src/.gitkeep
vendored
Normal file
0
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/in-files/src/.gitkeep
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib"]
|
||||
}
|
||||
0
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/out-files/src/.gitkeep
vendored
Normal file
0
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/out-files/src/.gitkeep
vendored
Normal file
0
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/stdout.txt
vendored
Normal file
0
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/stdout.txt
vendored
Normal file
Loading…
x
Reference in New Issue
Block a user