From 7896c682b1104ee1dec6d9ac409793ae0005e4d9 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 19 Apr 2023 13:24:51 -0400 Subject: [PATCH] fix(node): reduce deepReadDirSync runtime complexity (#7910) --- packages/node/src/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/node/src/utils.ts b/packages/node/src/utils.ts index 87fb8f6157e3..0ff47acf92c7 100644 --- a/packages/node/src/utils.ts +++ b/packages/node/src/utils.ts @@ -27,10 +27,11 @@ export function deepReadDirSync(targetDir: string): string[] { const itemAbsPath = path.join(currentDirAbsPath, itemName); if (fs.statSync(itemAbsPath).isDirectory()) { - return [...absPaths, ...deepReadCurrentDir(itemAbsPath)]; + return absPaths.concat(deepReadCurrentDir(itemAbsPath)); } - return [...absPaths, itemAbsPath]; + absPaths.push(itemAbsPath); + return absPaths; }, []); };