Skip to content

Commit

Permalink
fix(cli): fix "--out-dir" with single svg
Browse files Browse the repository at this point in the history
Closes #304
  • Loading branch information
gregberge committed Dec 23, 2019
1 parent 1bed23f commit b56407e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/cli/src/dirCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default async function dirCommand(
async function handle(filename, root) {
const stats = await stat(filename)

if (stats.isDirectory(filename)) {
if (stats.isDirectory()) {
const dirname = filename
const files = await readdir(dirname)
const results = await Promise.all(
Expand All @@ -90,5 +90,11 @@ export default async function dirCommand(
return write(filename, dest)
}

await Promise.all(filenames.map(file => handle(file, file)))
await Promise.all(
filenames.map(async file => {
const stats = await stat(file)
const root = stats.isDirectory() ? file : path.dirname(file)
return handle(file, root)
}),
)
}

0 comments on commit b56407e

Please sign in to comment.