From 01b6ec9380cd2f5c8b6a11fdf893211b84250487 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 23 Sep 2021 12:04:50 +0200 Subject: [PATCH] fix(): remove redundant await in for loop --- scripts/release/copyReleaseToProject.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/release/copyReleaseToProject.js b/scripts/release/copyReleaseToProject.js index 065326391f..9e7b89015a 100644 --- a/scripts/release/copyReleaseToProject.js +++ b/scripts/release/copyReleaseToProject.js @@ -17,12 +17,11 @@ async function main() { // Get pluggable widget folders containing "-native" const widgetFolderNames = await asyncFilter(await readdir(pluggableWidgetsFolderPath), isNativeWidgetFolder); const mpkPathsToCopy = []; - for await (const widgetFolderName of widgetFolderNames) { + for (const widgetFolderName of widgetFolderNames) { const widgetDistFolderPath = join(pluggableWidgetsFolderPath, widgetFolderName, "dist"); - const widgetDistFolderNames = await readdir(widgetDistFolderPath); const allMpkPaths = []; - for await (const widgetDistFolderName of widgetDistFolderNames) { + for (const widgetDistFolderName of await readdir(widgetDistFolderPath)) { // Check if folder name contains versioning if (!/\d+\.\d+\.\d+/.test(widgetDistFolderName)) { continue; @@ -46,14 +45,17 @@ async function main() { console.log( `Finished copying ${mpkPathsToCopy.length} widgets to Mendix project ${basename(process.env.MX_PROJECT_PATH)}` ); -}; +} async function asyncFilter(array, fn) { return Promise.all(array.map(fn)).then(booleans => array.filter((_, i) => booleans[i])); } async function isNativeWidgetFolder(widgetFolderName) { - return widgetFolderName.includes("-native") && (await stat(join(pluggableWidgetsFolderPath, widgetFolderName))).isDirectory(); + return ( + widgetFolderName.includes("-native") && + (await stat(join(pluggableWidgetsFolderPath, widgetFolderName))).isDirectory() + ); } async function getFileModifiedTime(path) {