Skip to content

Commit 8290f8b

Browse files
committed
Normalize line endings for lib files while building them
1 parent 8e94d84 commit 8290f8b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Jakefile.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,19 +353,16 @@ function prependFile(prefixFile, destinationFile) {
353353
// concatenate a list of sourceFiles to a destinationFile
354354
function concatenateFiles(destinationFile, sourceFiles) {
355355
var temp = "temptemp";
356-
// Copy the first file to temp
357-
if (!fs.existsSync(sourceFiles[0])) {
358-
fail(sourceFiles[0] + " does not exist!");
359-
}
360-
jake.cpR(sourceFiles[0], temp, { silent: true });
361356
// append all files in sequence
362-
for (var i = 1; i < sourceFiles.length; i++) {
357+
var text = "";
358+
for (var i = 0; i < sourceFiles.length; i++) {
363359
if (!fs.existsSync(sourceFiles[i])) {
364360
fail(sourceFiles[i] + " does not exist!");
365361
}
366-
fs.appendFileSync(temp, "\n\n");
367-
fs.appendFileSync(temp, fs.readFileSync(sourceFiles[i]));
362+
if (i > 0) { text += "\n\n"; }
363+
text += fs.readFileSync(sourceFiles[i]).toString().replace(/\r?\n/g, "\n");
368364
}
365+
fs.writeFileSync(temp, text);
369366
// Move the file to the final destination
370367
fs.renameSync(temp, destinationFile);
371368
}

0 commit comments

Comments
 (0)