From c619de0b3eda66d62b303b4525903dd76c02e71a Mon Sep 17 00:00:00 2001 From: bedi gupta Date: Thu, 10 Oct 2024 20:56:01 +0530 Subject: [PATCH] Removed the async keyword from the Promise executor function and undo the last commit --- apps/generator/lib/hooksRegistry.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/generator/lib/hooksRegistry.js b/apps/generator/lib/hooksRegistry.js index 2c21389fb..1e1eb43a6 100644 --- a/apps/generator/lib/hooksRegistry.js +++ b/apps/generator/lib/hooksRegistry.js @@ -24,11 +24,12 @@ module.exports.registerHooks = async (hooks, templateConfig, templateDir, hooksD * @param {String} templateDir Directory where template is located. * @param {String} hooksDir Directory where local hooks are located. */ -async function registerLocalHooks(hooks, templateDir, hooksDir) { - return new Promise(async (resolve, reject) => { +function registerLocalHooks(hooks, templateDir, hooksDir) { + return new Promise((resolve, reject) => { const localHooks = path.resolve(templateDir, hooksDir); - if (!await exists(localHooks)) return resolve(hooks); + exists(localHooks).then(localHooksExist => { + if (!localHooksExist) return resolve(hooks); const walker = xfs.walk(localHooks, { followLinks: false @@ -58,7 +59,8 @@ async function registerLocalHooks(hooks, templateDir, hooksDir) { walker.on('end', async () => { resolve(hooks); }); - }); + }).catch(reject); + }); } /**