Skip to content

Commit a25a0c0

Browse files
authored
feat: add a prompt to skip example code (#787)
Follow-up of #636 Making the option more visible to regular users.
1 parent e6b8d56 commit a25a0c0

File tree

9 files changed

+43
-3
lines changed

9 files changed

+43
-3
lines changed

index.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ type PromptResult = {
100100
features?: (typeof FEATURE_OPTIONS)[number]['value'][]
101101
e2eFramework?: 'cypress' | 'nightwatch' | 'playwright'
102102
experimentFeatures?: (typeof EXPERIMENTAL_FEATURE_OPTIONS)[number]['value'][]
103+
needsBareboneTemplates?: boolean
103104
}
104105

105106
function isValidPackageName(projectName) {
@@ -251,6 +252,9 @@ async function init() {
251252
features: [],
252253
e2eFramework: undefined,
253254
experimentFeatures: [],
255+
256+
// TODO: default to true sometime in the future
257+
needsBareboneTemplates: false,
254258
}
255259

256260
intro(
@@ -352,7 +356,19 @@ async function init() {
352356
)
353357
}
354358

355-
const { features, experimentFeatures } = result
359+
if (argv.bare) {
360+
result.needsBareboneTemplates = true
361+
} else if (!isFeatureFlagsUsed) {
362+
result.needsBareboneTemplates = await unwrapPrompt(
363+
confirm({
364+
message: language.needsBareboneTemplates.message,
365+
// TODO: default to true sometime in the future
366+
initialValue: false,
367+
}),
368+
)
369+
}
370+
371+
const { features, experimentFeatures, needsBareboneTemplates } = result
356372

357373
const needsTypeScript = argv.ts || argv.typescript || features.includes('typescript')
358374
const needsJsx = argv.jsx || features.includes('jsx')
@@ -562,7 +578,7 @@ async function init() {
562578
},
563579
)
564580

565-
if (argv.bare) {
581+
if (needsBareboneTemplates) {
566582
trimBoilerplate(root)
567583
render('bare/base')
568584
// TODO: refactor the `render` utility to avoid this kind of manual mapping?
@@ -629,7 +645,7 @@ async function init() {
629645
)
630646
}
631647

632-
if (argv.bare) {
648+
if (needsBareboneTemplates) {
633649
removeCSSImport(root, needsTypeScript, needsCypressCT)
634650
if (needsRouter) {
635651
emptyRouterConfig(root, needsTypeScript)

locales/en-US.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"needsRolldownVite": {
7373
"message": "rolldown-vite (experimental)"
7474
},
75+
"needsBareboneTemplates": {
76+
"message": "Skip all example code and start with a blank Vue project?"
77+
},
7578
"errors": {
7679
"operationCancelled": "Operation cancelled"
7780
},

locales/fr-FR.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"needsRolldownVite": {
7373
"message": "rolldown-vite (expérimental)"
7474
},
75+
"needsBareboneTemplates": {
76+
"message": "Ignorer tout le code d'exemple et commencer avec un projet Vue vierge\u00a0?"
77+
},
7578
"errors": {
7679
"operationCancelled": "Operation annulée"
7780
},

locales/tr-TR.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"needsRolldownVite": {
7373
"message": "rolldown-vite (deneysel)"
7474
},
75+
"needsBareboneTemplates": {
76+
"message": "Tüm örnek kodları atlayıp boş bir Vue projesi ile başlansın mı?"
77+
},
7578
"errors": {
7679
"operationCancelled": "İşlem iptal edildi"
7780
},

locales/zh-Hans.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"needsRolldownVite": {
7373
"message": "rolldown-vite(试验阶段)"
7474
},
75+
"needsBareboneTemplates": {
76+
"message": "跳过所有示例代码,创建一个空白的 Vue 项目?"
77+
},
7578
"errors": {
7679
"operationCancelled": "操作取消"
7780
},

locales/zh-Hant.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"needsRolldownVite": {
7373
"message": "rolldown-vite(試驗性功能)"
7474
},
75+
"needsBareboneTemplates": {
76+
"message": "跳過所有範例程式碼,建立一個空白的 Vue 專案?"
77+
},
7578
"errors": {
7679
"operationCancelled": "操作取消"
7780
},

template/bare/base/src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<template>
44
<h1>You did it!</h1>
5+
<p>
6+
Visit <a href="https://vuejs.org/" target="_blank" rel="noopener">vuejs.org</a> to read the
7+
documentation
8+
</p>
59
</template>
610

711
<style scoped></style>

template/bare/typescript/src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<template>
44
<h1>You did it!</h1>
5+
<p>
6+
Visit <a href="https://vuejs.org/" target="_blank" rel="noopener">vuejs.org</a> to read the
7+
documentation
8+
</p>
59
</template>
610

711
<style scoped></style>

utils/getLanguage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ interface Language {
4141
needsExperimentalFeatures: LanguageItem
4242
needsOxlint: LanguageItem
4343
needsRolldownVite: LanguageItem
44+
needsBareboneTemplates: LanguageItem
4445
errors: {
4546
operationCancelled: string
4647
}

0 commit comments

Comments
 (0)