| 11 | const unusedFunctionDir = functionDir !== 'f' ? 'f' : 'functions'; |
| 12 | |
| 13 | function writeFile(directory, pathname, buffer, dirs) { |
| 14 | |
| 15 | pathname = path.join.apply(path, [].concat(directory.split('/'), pathname.split('/'))); |
| 16 | let paths = pathname.split(path.sep); |
| 17 | |
| 18 | for (let i = 1; i < paths.length; i++) { |
| 19 | let dirpath = path.join.apply(path, [process.cwd()].concat(paths.slice(0, i))); |
| 20 | if (!dirs[dirpath]) { |
| 21 | !fs.existsSync(dirpath) && fs.mkdirSync(dirpath); |
| 22 | dirs[dirpath] = true; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | fs.writeFileSync(path.join(process.cwd(), pathname), buffer, {mode: 0o777}); |
| 27 | return dirs; |
| 28 | |
| 29 | } |
| 30 | |
| 31 | function writeFiles(directory, files) { |
| 32 | |