Skip to content

feat: add a prompt to skip example code #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -251,6 +252,9 @@ async function init() {
features: [],
e2eFramework: undefined,
experimentFeatures: [],

// TODO: default to true sometime in the future
needsBareboneTemplates: false,
}

intro(
Expand Down Expand Up @@ -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
Copy link
Member Author

@haoqunjiang haoqunjiang Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a must.

But when working on the many experimental features I'm planning, I can't help but think that defaulting to barebone templates would make life easier for those who want to try out these new features.

Demo code is still useful for newcomers and for educational purposes, though.

initialValue: false,
}),
)
}

const { features, experimentFeatures, needsBareboneTemplates } = result

const needsTypeScript = argv.ts || argv.typescript || features.includes('typescript')
const needsJsx = argv.jsx || features.includes('jsx')
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -629,7 +645,7 @@ async function init() {
)
}

if (argv.bare) {
if (needsBareboneTemplates) {
removeCSSImport(root, needsTypeScript, needsCypressCT)
if (needsRouter) {
emptyRouterConfig(root, needsTypeScript)
Expand Down
3 changes: 3 additions & 0 deletions locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite(试验阶段)"
},
"needsBareboneTemplates": {
"message": "跳过所有示例代码,创建一个空白的 Vue 项目?"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
3 changes: 3 additions & 0 deletions locales/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"needsRolldownVite": {
"message": "rolldown-vite(試驗性功能)"
},
"needsBareboneTemplates": {
"message": "跳過所有範例程式碼,建立一個空白的 Vue 專案?"
},
"errors": {
"operationCancelled": "操作取消"
},
Expand Down
4 changes: 4 additions & 0 deletions template/bare/base/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
4 changes: 4 additions & 0 deletions template/bare/typescript/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
1 change: 1 addition & 0 deletions utils/getLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface Language {
needsExperimentalFeatures: LanguageItem
needsOxlint: LanguageItem
needsRolldownVite: LanguageItem
needsBareboneTemplates: LanguageItem
errors: {
operationCancelled: string
}
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy