]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
feat: add a prompt to skip example code (#787)
authorHaoqun Jiang <haoqunjiang@gmail.com>
Sat, 26 Jul 2025 18:20:54 +0000 (02:20 +0800)
committerGitHub <noreply@github.com>
Sat, 26 Jul 2025 18:20:54 +0000 (02:20 +0800)
Follow-up of #636
Making the option more visible to regular users.

index.ts
locales/en-US.json
locales/fr-FR.json
locales/tr-TR.json
locales/zh-Hans.json
locales/zh-Hant.json
template/bare/base/src/App.vue
template/bare/typescript/src/App.vue
utils/getLanguage.ts

index da5d99f9f3b2989a5b54730a7e7790a872f09292..4d77d0904b01345db6f656adbf37cf48c2ebc62a 100755 (executable)
--- a/index.ts
+++ b/index.ts
@@ -100,6 +100,7 @@ type PromptResult = {
   features?: (typeof FEATURE_OPTIONS)[number]['value'][]
   e2eFramework?: 'cypress' | 'nightwatch' | 'playwright'
   experimentFeatures?: (typeof EXPERIMENTAL_FEATURE_OPTIONS)[number]['value'][]
+  needsBareboneTemplates?: boolean
 }
 
 function isValidPackageName(projectName) {
@@ -251,6 +252,9 @@ async function init() {
     features: [],
     e2eFramework: undefined,
     experimentFeatures: [],
+
+    // TODO: default to true sometime in the future
+    needsBareboneTemplates: false,
   }
 
   intro(
@@ -352,7 +356,19 @@ async function init() {
     )
   }
 
-  const { features, experimentFeatures } = result
+  if (argv.bare) {
+    result.needsBareboneTemplates = true
+  } else if (!isFeatureFlagsUsed) {
+    result.needsBareboneTemplates = await unwrapPrompt(
+      confirm({
+        message: language.needsBareboneTemplates.message,
+        // TODO: default to true sometime in the future
+        initialValue: false,
+      }),
+    )
+  }
+
+  const { features, experimentFeatures, needsBareboneTemplates } = result
 
   const needsTypeScript = argv.ts || argv.typescript || features.includes('typescript')
   const needsJsx = argv.jsx || features.includes('jsx')
@@ -562,7 +578,7 @@ async function init() {
     },
   )
 
-  if (argv.bare) {
+  if (needsBareboneTemplates) {
     trimBoilerplate(root)
     render('bare/base')
     // TODO: refactor the `render` utility to avoid this kind of manual mapping?
@@ -629,7 +645,7 @@ async function init() {
     )
   }
 
-  if (argv.bare) {
+  if (needsBareboneTemplates) {
     removeCSSImport(root, needsTypeScript, needsCypressCT)
     if (needsRouter) {
       emptyRouterConfig(root, needsTypeScript)
index 57c6790e059df6dcc1f1f6bf2f79c699ac56d89f..d5ab60a6513acc18b067412a06537872731e739c 100644 (file)
@@ -72,6 +72,9 @@
   "needsRolldownVite": {
     "message": "rolldown-vite (experimental)"
   },
+  "needsBareboneTemplates": {
+    "message": "Skip all example code and start with a blank Vue project?"
+  },
   "errors": {
     "operationCancelled": "Operation cancelled"
   },
index a8b6d1be745849e22b79b53a37c9b519a1c68b5f..3a2f22895b156f8d1e700e557bd16b30a7b4be4b 100644 (file)
@@ -72,6 +72,9 @@
   "needsRolldownVite": {
     "message": "rolldown-vite (expérimental)"
   },
+  "needsBareboneTemplates": {
+    "message": "Ignorer tout le code d'exemple et commencer avec un projet Vue vierge\u00a0?"
+  },
   "errors": {
     "operationCancelled": "Operation annulée"
   },
index c42b68231cf34c0ed8bac62bd7ca21f4c64580db..bafa189341e7ae68d4ed037493e9034bdfbbd29c 100644 (file)
@@ -72,6 +72,9 @@
   "needsRolldownVite": {
     "message": "rolldown-vite (deneysel)"
   },
+  "needsBareboneTemplates": {
+    "message": "Tüm örnek kodları atlayıp boş bir Vue projesi ile başlansın mı?"
+  },
   "errors": {
     "operationCancelled": "İşlem iptal edildi"
   },
index db41975c00c80bf127f9c9c35784a6be2e5cac41..9fe1e22fd8571bdca6b3c3e540a33b0c978c57f6 100644 (file)
@@ -72,6 +72,9 @@
   "needsRolldownVite": {
     "message": "rolldown-vite(试验阶段)"
   },
+  "needsBareboneTemplates": {
+    "message": "跳过所有示例代码,创建一个空白的 Vue 项目?"
+  },
   "errors": {
     "operationCancelled": "操作取消"
   },
index 53046101c1a106d3a6800f0dcfc876645f68a3aa..ec0c1f1aa58506ee012764c3e2fc788a6f08bbd8 100644 (file)
@@ -72,6 +72,9 @@
   "needsRolldownVite": {
     "message": "rolldown-vite(試驗性功能)"
   },
+  "needsBareboneTemplates": {
+    "message": "跳過所有範例程式碼,建立一個空白的 Vue 專案?"
+  },
   "errors": {
     "operationCancelled": "操作取消"
   },
index d3d95dda3711698c7b92cb8f6f29b54080376bff..6ec9f6039c5b04e0f7f68ec3af94e6a89913a16e 100644 (file)
@@ -2,6 +2,10 @@
 
 <template>
   <h1>You did it!</h1>
+  <p>
+    Visit <a href="https://vuejs.org/" target="_blank" rel="noopener">vuejs.org</a> to read the
+    documentation
+  </p>
 </template>
 
 <style scoped></style>
index 9a8afec5f030adaeb0d2603dbb9f2f9ddaf49501..abfd315f5df3539c2e8384787f516632c32c0ad4 100644 (file)
@@ -2,6 +2,10 @@
 
 <template>
   <h1>You did it!</h1>
+  <p>
+    Visit <a href="https://vuejs.org/" target="_blank" rel="noopener">vuejs.org</a> to read the
+    documentation
+  </p>
 </template>
 
 <style scoped></style>
index ade2c606830351644e9bc539a5b82a5b26603824..5d81d2a001eee269d7b4de8f79de26ad356efd10 100644 (file)
@@ -41,6 +41,7 @@ interface Language {
   needsExperimentalFeatures: LanguageItem
   needsOxlint: LanguageItem
   needsRolldownVite: LanguageItem
+  needsBareboneTemplates: LanguageItem
   errors: {
     operationCancelled: string
   }