| 126 | } |
| 127 | |
| 128 | function applyTemplate(config) { |
| 129 | if (!config.template) return; |
| 130 | |
| 131 | if (!fs.existsSync(config.template)) { |
| 132 | const errorMessage = Errors.missingTemplateFile(config.template); |
| 133 | process.stderr.write(errorMessage); |
| 134 | process.exit(1); |
| 135 | } |
| 136 | |
| 137 | var templateConfig = Comb.detectInFile(config.template); |
| 138 | for (var attrname in templateConfig) { |
| 139 | if (templateConfig.hasOwnProperty(attrname) && !config[attrname]) { |
| 140 | config[attrname] = templateConfig[attrname]; |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | function processFiles(files) { |
| 146 | const promises = files.map(file => { |