From ed293440642e004111e6fcdceafcbbc153f72bde Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Wed, 2 Feb 2022 18:57:56 -0800 Subject: [PATCH] bootstrap: drop unneeded "customCopyFile" --- prelude/bootstrap.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/prelude/bootstrap.js b/prelude/bootstrap.js index d0ea831e7..df34da631 100644 --- a/prelude/bootstrap.js +++ b/prelude/bootstrap.js @@ -179,19 +179,7 @@ function copyInChunks( fs_.closeSync(targetFile); } -function customCopyFile(source, target, chunkSize) { - let targetFile = target; - - // If target is a directory, a new file with the same name will be created - if (fs.existsSync(target)) { - if (fs.lstatSync(target).isDirectory()) { - targetFile = path.join(target, path.basename(source)); - } - } - - copyInChunks(source, targetFile, chunkSize); -} - +// TODO: replace this with fs.cpSync when we drop Node < 16 function copyFolderRecursiveSync(source, target) { let files = []; @@ -209,7 +197,10 @@ function copyFolderRecursiveSync(source, target) { if (fs.lstatSync(curSource).isDirectory()) { copyFolderRecursiveSync(curSource, targetFolder); } else { - customCopyFile(curSource, targetFolder); + fs.copyFileSync( + curSource, + path.join(targetFolder, path.basename(curSource)) + ); } }); }