docs: function buildTree(directory, depth, parentGitignoreList) {
    const files = fs.readdirSync(directory);
    const max_index = files.length - 1
    const color = chalk[colors[depth % colors.length]]
    parentGitignoreList = parentGitignoreList || []
    const gitignoreList = hideFilesInGitIgnore
      ? parentGitignoreList.concat(readGitignore(directory))
      : []
  
    for (let i = 0; i <= max_index; i++) {
      const file = files[i]
      depths[depth] = max_index - i
      const fullPath = path.resolve(directory, file)
      let printWithoutDescending = false
      let postfix = ''
      let prefix = buildPrefix(depth, i === max_index, directory)
      const stats = fs.statSync(fullPath)
      const isDirectory = stats.isDirectory()
      const size = prettybytes(stats.size)
  
      if (showTimeStamp) {
        prefix += dateTemplate.render(new Date(stats.mtime))
      }
  
      if (isDirectory) {
        directoryCount++
      } else {
        fileCount++
        totalFileSize += stats.size
      }
  
      if (!shouldBeIncluded(file)) {
        continue
      }
  
      if (hideFilesInGitIgnore) {
        let matchesGitIgnoreEntry = false
        let m = gitignoreList.length
        while (!matchesGitIgnoreEntry && m > 0) {
          matchesGitIgnoreEntry = minimatch(file, gitignoreList[m - 1])
          m--
        }
  
        if (matchesGitIgnoreEntry) {
          continue
        }
      }
  
      if (!isDirectory && showOnlyDirectories) {
        continue
      }
  
      if (isDirectory) {
        if (fileLimit !== Infinity || pruneEmptyDirectories) {
          const dirfiles = fs.readdirSync(fullPath).filter(shouldBeIncluded)
          if (pruneEmptyDirectories && dirfiles.length === 0) {
            continue
          }
          if (dirfiles.length > fileLimit) {
            printWithoutDescending = true
            postfix = ` [${dirfiles.length} entries exceeds filelimit (${fileLimit}), not opening dir]`
          }
        }
      }
  
      const filename = showFullPath ? color(fullPath.replace(cwd + '/', '')) : color(file)
      const JSXTags = createJSXTags(filename, isDirectory, size, fullPath)
  
      if (printJSX) {
        output += prefix + JSXTags.open + '\n'
      } else {
        output += prefix + filename + (!isDirectory && showSize ? ` (${size})` : '') + postfix + '\n';
      }
      if (printWithoutDescending) {
        continue
      }
      if (isDirectory && (depth + 1 < maxDepth)) {
        buildTree(path.resolve(directory, file), depth + 1, gitignoreList)
      }
      if (printJSX && JSXTags.close) {
        output += prefix + JSXTags.close + '\n'
      }
      --depths[depth]
    }
  }