import glob from 'glob'
import { exclude } from './config.json'

export default async (dir, ignore = []) => {
  return new Promise(resolve => {
    glob('**',
      {ignore: [...ignore, ...exclude], root: dir, follow: false},
      (err, files) => {
        files = err ? null : files
        resolve(files)
      }
    )
  })
}

@@ -133,24 +133,127 @@
 esolve =%3E %7B%0A
+    // A hack for applying glob only under 'dir'%0A    const cwd = process.cwd()%0A    process.chdir(dir)%0A%0A
     glob('**
@@ -298,19 +298,8 @@
 de%5D,
- root: dir,
  fol
@@ -331,24 +331,104 @@
 files) =%3E %7B%0A
+        // Revert the change we made in cwd earlier%0A        process.chdir(cwd)%0A%0A
         file

work only inside given directory