Skip to content

Commit a142f80

Browse files
committed
refactor: update English prompts
1 parent 7004826 commit a142f80

File tree

3 files changed

+94
-60
lines changed

3 files changed

+94
-60
lines changed

index.ts

Lines changed: 60 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -263,16 +263,44 @@ async function init() {
263263

264264
if (!isFeatureFlagsUsed) {
265265
const features = await multiselect({
266-
message: `Select the features you want to enable: ${dim('(↑/↓ to navigate, space to select, a to select/deselect all, return to submit)')}`,
266+
message: `${language.featureSelection.message} ${dim(language.featureSelection.hint)}`,
267267
options: [
268-
{ value: 'typescript', label: language.needsTypeScript.message },
269-
{ value: 'jsx', label: language.needsJsx.message },
270-
{ value: 'router', label: language.needsRouter.message },
271-
{ value: 'pinia', label: language.needsPinia.message },
272-
{ value: 'vitest', label: language.needsVitest.message },
273-
{ value: 'e2e', label: language.needsE2eTesting.message },
274-
{ value: 'eslint', label: language.needsEslint.message },
275-
{ value: 'prettier', label: language.needsPrettier.message },
268+
{
269+
value: 'typescript',
270+
label: language.needsTypeScript.message,
271+
hint: language.needsTypeScript.hint,
272+
},
273+
{ value: 'jsx', label: language.needsJsx.message, hint: language.needsJsx.hint },
274+
{
275+
value: 'router',
276+
label: language.needsRouter.message,
277+
hint: language.needsRouter.hint,
278+
},
279+
{
280+
value: 'pinia',
281+
label: language.needsPinia.message,
282+
hint: language.needsPinia.hint,
283+
},
284+
{
285+
value: 'vitest',
286+
label: language.needsVitest.message,
287+
hint: language.needsVitest.hint,
288+
},
289+
{
290+
value: 'e2e',
291+
label: language.needsE2eTesting.message,
292+
hint: language.needsE2eTesting.hint,
293+
},
294+
{
295+
value: 'eslint',
296+
label: language.needsEslint.message,
297+
hint: language.needsEslint.hint,
298+
},
299+
{
300+
value: 'prettier',
301+
label: language.needsPrettier.message,
302+
hint: language.needsPrettier.hint,
303+
},
276304
],
277305
required: false,
278306
})
@@ -285,25 +313,26 @@ async function init() {
285313

286314
if (features.includes('e2e')) {
287315
const e2eTestingInput = await select({
288-
message: `${language.needsE2eTesting.message}: ${dim('(↑/↓ to navigate, return to submit)')}`,
316+
message: `${language.e2eSelection.message} ${dim(language.e2eSelection.hint)}`,
289317
options: [
318+
{
319+
value: 'playwright',
320+
label: language.e2eSelection.selectOptions.playwright.title,
321+
hint: language.e2eSelection.selectOptions.playwright.desc,
322+
},
290323
{
291324
value: 'cypress',
292-
label: language.needsE2eTesting.selectOptions.cypress.title,
325+
label: language.e2eSelection.selectOptions.cypress.title,
293326
hint: features.includes('vitest')
294-
? undefined
295-
: language.needsE2eTesting.selectOptions.cypress.desc,
327+
? language.e2eSelection.selectOptions.cypress.desc
328+
: language.e2eSelection.selectOptions.cypress.hintOnComponentTesting!,
296329
},
297330
{
298331
value: 'nightwatch',
299-
label: language.needsE2eTesting.selectOptions.nightwatch.title,
332+
label: language.e2eSelection.selectOptions.nightwatch.title,
300333
hint: features.includes('vitest')
301-
? undefined
302-
: language.needsE2eTesting.selectOptions.nightwatch.desc,
303-
},
304-
{
305-
value: 'playwright',
306-
label: language.needsE2eTesting.selectOptions.playwright.title,
334+
? language.e2eSelection.selectOptions.nightwatch.desc
335+
: language.e2eSelection.selectOptions.nightwatch.hintOnComponentTesting!,
307336
},
308337
],
309338
})
@@ -316,25 +345,16 @@ async function init() {
316345
}
317346

318347
if (features.includes('eslint')) {
319-
const eslintInput = await select({
320-
message: language.needsEslint.message,
321-
options: [
322-
{
323-
value: 'eslintOnly',
324-
label: language.needsEslint.selectOptions.eslintOnly.title,
325-
},
326-
{
327-
value: 'speedUpWithOxlint',
328-
label: language.needsEslint.selectOptions.speedUpWithOxlint.title,
329-
},
330-
],
348+
const oxlintInput = await confirm({
349+
message: language.needsOxlint.message,
350+
initialValue: false,
331351
})
332352

333-
if (isCancel(eslintInput)) {
353+
if (isCancel(oxlintInput)) {
334354
throw new Error(red('✖') + ` ${language.errors.operationCancelled}`)
335355
}
336356

337-
result.needsEslint = eslintInput
357+
result.needsOxlint = oxlintInput
338358
}
339359
}
340360

@@ -676,7 +696,12 @@ async function init() {
676696
if (needsPrettier) {
677697
outroMessage += ` ${bold(green(getCommand(packageManager, 'format')))}\n`
678698
}
679-
outroMessage += ` ${bold(green(getCommand(packageManager, 'dev')))}`
699+
outroMessage += ` ${bold(green(getCommand(packageManager, 'dev')))}\n`
700+
701+
outroMessage += `
702+
${dim('|')} Optional: Initialize Git in your project directory with:
703+
704+
${bold(green('git init && git add -A && git commit -m "initial commit"'))}`
680705

681706
outro(outroMessage)
682707
}

locales/en-US.json

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,53 @@
1313
"message": "Package name:",
1414
"invalidMessage": "Invalid package.json name"
1515
},
16+
"featureSelection": {
17+
"message": "Select features to include in your project:",
18+
"hint": "(↑/↓ to navigate, space to select, a to toggle all, enter to confirm)"
19+
},
1620
"needsTypeScript": {
17-
"message": "Add TypeScript"
21+
"message": "TypeScript"
1822
},
1923
"needsJsx": {
20-
"message": "Add JSX Support"
24+
"message": "JSX Support"
2125
},
2226
"needsRouter": {
23-
"message": "Add Vue Router for Single Page Application development"
27+
"message": "Router (SPA development)"
2428
},
2529
"needsPinia": {
26-
"message": "Add Pinia for state management"
30+
"message": "Pinia (state management)"
2731
},
2832
"needsVitest": {
29-
"message": "Add Vitest for Unit Testing"
33+
"message": "Vitest (unit testing)"
3034
},
3135
"needsE2eTesting": {
32-
"message": "Add an End-to-End Testing Solution",
33-
"hint": "- Use arrow-keys. Return to submit.",
36+
"message": "End-to-End Testing"
37+
},
38+
"needsEslint": {
39+
"message": "ESLint (error prevention)"
40+
},
41+
"needsPrettier": {
42+
"message": "Prettier (code formatting)"
43+
},
44+
"e2eSelection": {
45+
"message": "Select an End-to-End testing framework:",
46+
"hint": "(↑/↓ to navigate, enter to confirm)",
3447
"selectOptions": {
35-
"negative": { "title": "No" },
48+
"playwright": { "title": "Playwright", "desc": "https://playwright.dev/" },
3649
"cypress": {
3750
"title": "Cypress",
38-
"desc": "also supports unit testing with Cypress Component Testing"
51+
"desc": "https://www.cypress.io/",
52+
"hintOnComponentTesting": "also supports unit testing with Cypress Component Testing - https://www.cypress.io/"
3953
},
4054
"nightwatch": {
4155
"title": "Nightwatch",
42-
"desc": "also supports unit testing with Nightwatch Component Testing"
43-
},
44-
"playwright": { "title": "Playwright" }
45-
}
46-
},
47-
"needsEslint": {
48-
"message": "Add ESLint for code quality",
49-
"selectOptions": {
50-
"negative": { "title": "No" },
51-
"eslintOnly": {
52-
"title": "Yes, just ESLint"
53-
},
54-
"speedUpWithOxlint": {
55-
"title": "Yes, and speed up with Oxlint (experimental)"
56+
"desc": "https://nightwatchjs.org/",
57+
"hintOnComponentTesting": "also supports unit testing with Nightwatch Component Testing - https://nightwatchjs.org/"
5658
}
5759
}
5860
},
59-
"needsPrettier": {
60-
"message": "Add Prettier for code formatting"
61+
"needsOxlint": {
62+
"message": "Install Oxlint for faster linting? (experimental)"
6163
},
6264
"errors": {
6365
"operationCancelled": "Operation cancelled"

utils/getLanguage.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface Language {
2222
projectName: LanguageItem
2323
shouldOverwrite: LanguageItem
2424
packageName: LanguageItem
25+
featureSelection: LanguageItem
2526
needsTypeScript: LanguageItem
2627
needsJsx: LanguageItem
2728
needsRouter: LanguageItem
@@ -30,6 +31,12 @@ interface Language {
3031
needsE2eTesting: LanguageItem
3132
needsEslint: LanguageItem
3233
needsPrettier: LanguageItem
34+
e2eSelection: LanguageItem & {
35+
selectOptions?: {
36+
[key: string]: { title: string; desc?: string; hintOnComponentTesting?: string }
37+
}
38+
}
39+
needsOxlint: LanguageItem
3340
errors: {
3441
operationCancelled: string
3542
}

0 commit comments

Comments
 (0)