| 29 | } |
| 30 | |
| 31 | function writeFiles(directory, files) { |
| 32 | |
| 33 | Object.keys(files) |
| 34 | .reduce((dirs, pathname) => { |
| 35 | // Makes sure templates work with new directory names |
| 36 | let writePath = pathname; |
| 37 | let unused = `${unusedFunctionDir}/`; |
| 38 | if (pathname.substr(0, unused.length) === unused) { |
| 39 | writePath = `${functionDir}/${pathname.substr(unused.length)}`; |
| 40 | } |
| 41 | return writeFile(directory, writePath, files[pathname], dirs); |
| 42 | }, {}); |
| 43 | |
| 44 | } |
| 45 | |
| 46 | function readFiles(basepath, pathname, files, condenseDots) { |
| 47 | basepath = basepath || '.'; |