Skip to content

Commit 401578a

Browse files
committed
run normal initialization flow on parallel
1 parent afb6a6e commit 401578a

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

extensions/cli/src/onboarding.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,24 +280,35 @@ export async function initializeWithOnboarding(
280280
authConfig: AuthConfig,
281281
configPath: string | undefined,
282282
rules?: string[],
283-
): Promise<OnboardingResult> {
283+
) {
284284
const firstTime = await isFirstTime();
285285

286-
let result: OnboardingResult;
287-
288286
if (firstTime) {
289-
result = await runOnboardingFlow(configPath, authConfig);
290-
if (result.wasOnboarded) {
287+
const onboardingResult = await runOnboardingFlow(configPath, authConfig);
288+
if (onboardingResult.wasOnboarded) {
291289
await markOnboardingComplete();
292290
}
291+
// Inject rules into the config if provided (for onboarding flow which doesn't handle rules directly)
292+
if (rules && rules.length > 0 && !onboardingResult.wasOnboarded) {
293+
onboardingResult.config = await injectRulesIntoConfig(
294+
onboardingResult.config,
295+
rules,
296+
);
297+
}
293298
} else {
294-
result = await runNormalFlow(authConfig, configPath, rules);
295-
}
296-
297-
// Inject rules into the config if provided (for onboarding flow which doesn't handle rules directly)
298-
if (rules && rules.length > 0 && !result.wasOnboarded) {
299-
result.config = await injectRulesIntoConfig(result.config, rules);
299+
// when running normal flow, initialize (remote) config asynchronously
300+
void (async () => {
301+
const onboardingResult = await runNormalFlow(
302+
authConfig,
303+
configPath,
304+
rules,
305+
);
306+
if (rules && rules.length > 0) {
307+
onboardingResult.config = await injectRulesIntoConfig(
308+
onboardingResult.config,
309+
rules,
310+
);
311+
}
312+
})();
300313
}
301-
302-
return result;
303314
}

0 commit comments

Comments
 (0)