From 09734d7879228208bd0736d7152d526218dab63d Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Wed, 3 Oct 2018 14:54:53 -0500 Subject: [PATCH] call path.basename w/ extension name to avoid e.g. `.js.1.js` --- lib/core/fs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/fs.js b/lib/core/fs.js index 2edfd5f3..01a987dc 100644 --- a/lib/core/fs.js +++ b/lib/core/fs.js @@ -120,9 +120,10 @@ function copyPreserve(sourceFilePath, targetFilePath) { let ext = 1; let preserved = targetFilePath; while (fs.existsSync(preserved)) { + let extname = path.extname(targetFilePath); preserved = utils.joinPath( path.dirname(targetFilePath), - `${path.basename(targetFilePath)}.${ext}${path.extname(targetFilePath)}` + `${path.basename(targetFilePath, extname)}.${ext}${extname}` ); ext++; }