miki-moni 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli/setup-wizard.ts +11 -12
package/package.json
CHANGED
package/src/cli/setup-wizard.ts
CHANGED
|
@@ -43,17 +43,14 @@ export interface SetupWizardOpts {
|
|
|
43
43
|
|
|
44
44
|
export async function runSetupWizard(cfg: Config, opts: SetupWizardOpts = {}): Promise<Config> {
|
|
45
45
|
// Step 0: pick UI language (English / Traditional / Simplified Chinese)
|
|
46
|
-
//
|
|
47
|
-
//
|
|
46
|
+
// ALWAYS asked first — even on re-running `miki setup`, the user might
|
|
47
|
+
// want to switch. cfg.locale (if present) becomes the default so existing
|
|
48
|
+
// users can just hit Enter to keep it.
|
|
48
49
|
let cfgWithLocale = cfg;
|
|
49
50
|
if (!opts.forceChoice) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const lang = await pickLocale();
|
|
54
|
-
setLocale(lang);
|
|
55
|
-
cfgWithLocale = { ...cfg, locale: lang };
|
|
56
|
-
}
|
|
51
|
+
const lang = await pickLocale(cfg.locale);
|
|
52
|
+
setLocale(lang);
|
|
53
|
+
if (lang !== cfg.locale) cfgWithLocale = { ...cfg, locale: lang };
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
const choice = opts.forceChoice ?? await pickChoice();
|
|
@@ -77,15 +74,17 @@ export async function shouldRunWizard(cfg: Config): Promise<boolean> {
|
|
|
77
74
|
return true;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
async function pickLocale(): Promise<Locale> {
|
|
81
|
-
//
|
|
77
|
+
async function pickLocale(current?: Locale): Promise<Locale> {
|
|
78
|
+
// Tri-lingual banner — at this point we don't know which language the user
|
|
79
|
+
// reads so all three are shown side by side. Default falls back to the
|
|
80
|
+
// existing config locale (re-running `miki setup`) or "en" on first run.
|
|
82
81
|
console.log("");
|
|
83
82
|
console.log("✨ Welcome to miki-moni! / 歡迎 / 欢迎");
|
|
84
83
|
console.log("");
|
|
85
84
|
return await select<Locale>({
|
|
86
85
|
message: "Language / 語言 / 语言:",
|
|
87
86
|
choices: LOCALE_CHOICES.map((c) => ({ name: c.name, value: c.value })),
|
|
88
|
-
default: "en",
|
|
87
|
+
default: current ?? "en",
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
90
|
|