Skip to content

Commit

Permalink
Fix empty challenge directory error
Browse files Browse the repository at this point in the history
It occured after moving back from challenge branch to the main.
  • Loading branch information
almirsarajcic committed Mar 18, 2022
1 parent dcc86e0 commit 7282120
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
const { readdirSync } = require('fs')
const { resolve } = require('path')

const isDirEmpty = (directory, subdirectory) => {
const path = resolve(directory, subdirectory)
return readdirSync(path).length === 0
}

const getDirectories = (source) =>
readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.filter(
(dirent) => dirent.isDirectory() && !isDirEmpty(source, dirent.name)
)
.map((dirent) => dirent.name)

const foreachChallenge = (command) => {
Expand Down

0 comments on commit 7282120

Please sign in to comment.