Skip to content

Commit d9630fc

Browse files
author
Ovidiu Barabula
committed
fix(core): resolve plugin manager promises in sequence instead of parallel
Configuration questionnaire were trying to run all at the same time, which meant only one questionnaire configuration was being saved. Promise.all() waits for the promises to be resolved in parallel. Switching to a 'for, of' loop with await makes sure all the questionnaire are started in sequence.
1 parent b146733 commit d9630fc

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/config-wizard/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ function ConfigWizard(
252252

253253
// Merge configuration defaults with answers from questionnaire
254254
const newAnswers = { ...currentDefaults, ...answers };
255+
const stringAnswers = JSON.stringify(newAnswers, null, 2);
255256

256-
logger.info(`Your '${questionnaire.namespace}' configuration:`);
257-
console.log(JSON.stringify(newAnswers, null, 2));
257+
logger.info(`Your '${questionnaire.namespace}' configuration: \n${stringAnswers}`);
258258
return await setConfiguration(questionnaire.namespace, newAnswers);
259259
}
260260

@@ -275,7 +275,7 @@ function ConfigWizard(
275275
throw new Error(ERRORS.QUESTIONNARE_NAMESPACE_DOESNT_EXIST);
276276
}
277277

278-
logger.info(`Configure '${namespace}'`);
278+
logger.info(`Configure '${namespace}':`);
279279
return await inquirer.prompt(questionnaires[namespace]);
280280
}
281281

src/plugin-manager/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,11 @@ function PluginManager(taskManager: TaskManager, configWizard: IConfigWizard): P
145145
async function use(...plugins: PluginsArray): Promise<void> {
146146
// Parse plugins array and get installable plugins
147147
const installablePlugins = await parsePlugins(plugins);
148+
148149
// Install each plugin
149-
await Promise.all(
150-
installablePlugins.map(
151-
async (plugin: Plugin) => await install(plugin),
152-
),
153-
);
150+
for (const plugin of installablePlugins) {
151+
await install(plugin);
152+
}
154153
}
155154

156155

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy