Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: overall structure and reliability of the function #1296

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions apps/generator/lib/hooksRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,7 +59,8 @@ async function registerLocalHooks(hooks, templateDir, hooksDir) {
walker.on('end', async () => {
resolve(hooks);
});
});
}).catch(reject);
});
}

/**
Expand Down
Loading