From a32e49f85b4a6d3e580797e46633cb5d4d3af151 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Fri, 10 Nov 2023 16:33:40 -0300 Subject: [PATCH] show languages selected choices on top. --- generators/languages/prompts.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generators/languages/prompts.mjs b/generators/languages/prompts.mjs index 8d0614edb351..ac85fe6db3b4 100644 --- a/generators/languages/prompts.mjs +++ b/generators/languages/prompts.mjs @@ -59,7 +59,9 @@ export async function askForLanguages({ control }) { choices: () => { const languageOptions = this.supportedLanguages; const nativeLanguage = this.jhipsterConfigWithDefaults.nativeLanguage; - return languagesAsChoices(languageOptions.filter(l => l.languageTag !== nativeLanguage)); + const choices = languagesAsChoices(languageOptions.filter(l => l.languageTag !== nativeLanguage)); + const defaults = this.jhipsterConfigWithDefaults.languages ?? []; + return [...choices.filter(({ value }) => defaults.includes(value)), ...choices.filter(({ value }) => !defaults.includes(value))]; }, default: () => this.jhipsterConfigWithDefaults.languages, },