From 07b6d181182a950331820eec78085d8d5bc31c54 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 23 Jul 2025 19:31:59 +0800 Subject: [PATCH 1/3] docs: add a link to the official documentation in bare templates --- template/bare/base/src/App.vue | 4 ++++ template/bare/typescript/src/App.vue | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/template/bare/base/src/App.vue b/template/bare/base/src/App.vue index d3d95dda..6ec9f603 100644 --- a/template/bare/base/src/App.vue +++ b/template/bare/base/src/App.vue @@ -2,6 +2,10 @@ diff --git a/template/bare/typescript/src/App.vue b/template/bare/typescript/src/App.vue index 9a8afec5..abfd315f 100644 --- a/template/bare/typescript/src/App.vue +++ b/template/bare/typescript/src/App.vue @@ -2,6 +2,10 @@ From 88c6d00a180c47fb3ba6468bec9ccb2f81871464 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 23 Jul 2025 20:18:54 +0800 Subject: [PATCH 2/3] feat: add a prompt to skip example code Follow up of https://github.com/vuejs/create-vue/pull/636 --- index.ts | 20 +++++++++++++++++--- locales/en-US.json | 3 +++ locales/fr-FR.json | 3 +++ locales/tr-TR.json | 3 +++ locales/zh-Hans.json | 3 +++ locales/zh-Hant.json | 3 +++ utils/getLanguage.ts | 1 + 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index da5d99f9..00260189 100755 --- 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,7 @@ async function init() { features: [], e2eFramework: undefined, experimentFeatures: [], + needsBareboneTemplates: false, } intro( @@ -352,7 +354,19 @@ async function init() { ) } - const { features, experimentFeatures } = result + if (argv.bare) { + result.needsBareboneTemplates = true + } else { + 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 +576,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 +643,7 @@ async function init() { ) } - if (argv.bare) { + if (needsBareboneTemplates) { removeCSSImport(root, needsTypeScript, needsCypressCT) if (needsRouter) { emptyRouterConfig(root, needsTypeScript) diff --git a/locales/en-US.json b/locales/en-US.json index 57c6790e..d5ab60a6 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -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" }, diff --git a/locales/fr-FR.json b/locales/fr-FR.json index a8b6d1be..3a2f2289 100644 --- a/locales/fr-FR.json +++ b/locales/fr-FR.json @@ -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" }, diff --git a/locales/tr-TR.json b/locales/tr-TR.json index c42b6823..bafa1893 100644 --- a/locales/tr-TR.json +++ b/locales/tr-TR.json @@ -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" }, diff --git a/locales/zh-Hans.json b/locales/zh-Hans.json index db41975c..9fe1e22f 100644 --- a/locales/zh-Hans.json +++ b/locales/zh-Hans.json @@ -72,6 +72,9 @@ "needsRolldownVite": { "message": "rolldown-vite(试验阶段)" }, + "needsBareboneTemplates": { + "message": "跳过所有示例代码,创建一个空白的 Vue 项目?" + }, "errors": { "operationCancelled": "操作取消" }, diff --git a/locales/zh-Hant.json b/locales/zh-Hant.json index 53046101..ec0c1f1a 100644 --- a/locales/zh-Hant.json +++ b/locales/zh-Hant.json @@ -72,6 +72,9 @@ "needsRolldownVite": { "message": "rolldown-vite(試驗性功能)" }, + "needsBareboneTemplates": { + "message": "跳過所有範例程式碼,建立一個空白的 Vue 專案?" + }, "errors": { "operationCancelled": "操作取消" }, diff --git a/utils/getLanguage.ts b/utils/getLanguage.ts index ade2c606..5d81d2a0 100644 --- a/utils/getLanguage.ts +++ b/utils/getLanguage.ts @@ -41,6 +41,7 @@ interface Language { needsExperimentalFeatures: LanguageItem needsOxlint: LanguageItem needsRolldownVite: LanguageItem + needsBareboneTemplates: LanguageItem errors: { operationCancelled: string } From a83d7ea9dd92c2a53c404c2d04b9c44a234ece7e Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Sat, 26 Jul 2025 13:44:04 +0800 Subject: [PATCH 3/3] fix: skip "bare" prompt when feature flag is used --- index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 00260189..4d77d090 100755 --- a/index.ts +++ b/index.ts @@ -252,6 +252,8 @@ async function init() { features: [], e2eFramework: undefined, experimentFeatures: [], + + // TODO: default to true sometime in the future needsBareboneTemplates: false, } @@ -356,7 +358,7 @@ async function init() { if (argv.bare) { result.needsBareboneTemplates = true - } else { + } else if (!isFeatureFlagsUsed) { result.needsBareboneTemplates = await unwrapPrompt( confirm({ message: language.needsBareboneTemplates.message,