Skip to content

Commit bd13c9d

Browse files
committed
feat(vscode): enhance project creation with conditional options
- Add CSS framework selection for Vuetify 0 template - Add router selection for Vue projects with multiple router options - Extend features list with MCP, i18n, and conditional Vuetify Nuxt Module - Add client hints option for Nuxt with Vuetify Nuxt Module - Add Deno to package manager options - Restructure feature selection logic to handle conditional options
1 parent f8785a8 commit bd13c9d

File tree

1 file changed

+89
-13
lines changed

1 file changed

+89
-13
lines changed

packages/vscode/src/commands/create.ts

Lines changed: 89 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ interface FeatureItem extends QuickPickItem {
1717
value: string
1818
}
1919

20+
interface StringItem extends QuickPickItem {
21+
value: string
22+
}
23+
2024
export async function createProject () {
2125
// 1. Select Destination Directory
2226
const uri = await window.showOpenDialog({
@@ -89,7 +93,24 @@ export async function createProject () {
8993
return
9094
}
9195

92-
// 5. TypeScript
96+
// 5. CSS Framework (only for Vuetify 0)
97+
let cssFramework = 'none'
98+
if (template.value === 'vuetify0') {
99+
const cssItem = await window.showQuickPick<StringItem>(
100+
[
101+
{ label: 'UnoCSS', value: 'unocss', description: 'Instant on-demand atomic CSS engine', picked: true },
102+
{ label: 'Tailwind CSS', value: 'tailwindcss', description: 'Utility-first CSS framework' },
103+
{ label: 'None', value: 'none' },
104+
],
105+
{ placeHolder: 'Select CSS Framework' },
106+
)
107+
if (!cssItem) {
108+
return
109+
}
110+
cssFramework = cssItem.value
111+
}
112+
113+
// 6. TypeScript
93114
const tsItem = await window.showQuickPick<BoolItem>(
94115
[
95116
{ label: 'Yes', value: true, description: 'Use TypeScript', picked: true },
@@ -103,13 +124,41 @@ export async function createProject () {
103124
}
104125
const typescript = tsItem.value
105126

106-
// 6. Features
127+
// 7. Router (only for Vue)
128+
let router = 'none'
129+
if (platform === 'vue') {
130+
const routerItem = await window.showQuickPick<StringItem>(
131+
[
132+
{ label: 'Vue Router', value: 'router', description: 'Standard Vue Router', picked: true },
133+
{ label: 'File-based Router', value: 'file-router', description: 'unplugin-vue-router' },
134+
{ label: 'None', value: 'none' },
135+
],
136+
{ placeHolder: 'Select Router' },
137+
)
138+
if (!routerItem) {
139+
return
140+
}
141+
router = routerItem.value
142+
}
143+
144+
// 8. Features
145+
const featureOptions: FeatureItem[] = [
146+
{ label: 'ESLint', value: 'eslint', picked: true },
147+
{ label: 'MCP', value: 'mcp', description: 'Model Context Protocol', picked: true },
148+
{ label: 'Pinia', value: 'pinia', picked: true },
149+
{ label: 'i18n', value: 'i18n' },
150+
]
151+
152+
if (platform === 'nuxt' && template.value !== 'vuetify0') {
153+
featureOptions.push({
154+
label: 'Vuetify Nuxt Module',
155+
value: 'vuetify-nuxt-module',
156+
picked: true,
157+
})
158+
}
159+
107160
const featureItems = await window.showQuickPick<FeatureItem>(
108-
[
109-
{ label: 'Vue Router', value: 'router', picked: true },
110-
{ label: 'Pinia', value: 'pinia', picked: true },
111-
{ label: 'ESLint', value: 'eslint', picked: true },
112-
],
161+
featureOptions,
113162
{
114163
canPickMany: true,
115164
placeHolder: 'Select features',
@@ -119,11 +168,27 @@ export async function createProject () {
119168
if (!featureItems) {
120169
return
121170
}
122-
const features = featureItems.map(item => item.value)
171+
let features = featureItems.map(item => item.value)
172+
173+
// 9. Client Hints (only for Nuxt + vuetify-nuxt-module)
174+
let clientHints = false
175+
if (platform === 'nuxt' && features.includes('vuetify-nuxt-module')) {
176+
const hintsItem = await window.showQuickPick<BoolItem>(
177+
[
178+
{ label: 'No', value: false, picked: true },
179+
{ label: 'Yes', value: true, description: 'Enable Client Hints' },
180+
],
181+
{ placeHolder: 'Enable Client Hints?' },
182+
)
183+
if (!hintsItem) {
184+
return
185+
}
186+
clientHints = hintsItem.value
187+
}
123188

124-
// 7. Package Manager
189+
// 10. Package Manager
125190
const pmItem = await window.showQuickPick(
126-
['npm', 'pnpm', 'yarn', 'bun'],
191+
['npm', 'pnpm', 'yarn', 'bun', 'deno'],
127192
{ placeHolder: 'Select Package Manager' },
128193
)
129194

@@ -132,7 +197,7 @@ export async function createProject () {
132197
}
133198
const packageManager = pmItem
134199

135-
// 8. Install Dependencies
200+
// 11. Install Dependencies
136201
const installItem = await window.showQuickPick<BoolItem>(
137202
[
138203
{ label: 'Yes', value: true, description: 'Install dependencies after creation', picked: true },
@@ -148,7 +213,17 @@ export async function createProject () {
148213
}
149214
const install = installItem.value
150215

151-
// 9. Create Project
216+
// Assemble features array
217+
if (router !== 'none') {
218+
features.push(router)
219+
}
220+
if (cssFramework !== 'none') {
221+
features.push(cssFramework)
222+
} else if (template.value === 'vuetify0' && cssFramework === 'none') {
223+
features.push('css-none')
224+
}
225+
226+
// 12. Create Project
152227
await window.withProgress(
153228
{
154229
location: 15, // Notification
@@ -167,6 +242,7 @@ export async function createProject () {
167242
packageManager,
168243
install,
169244
force: true,
245+
clientHints,
170246
}, {
171247
onDownloadStart: () => progress.report({ message: 'Downloading template...' }),
172248
onConfigStart: () => progress.report({ message: 'Applying configuration...' }),
@@ -180,7 +256,7 @@ export async function createProject () {
180256
},
181257
)
182258

183-
// 10. Open Project
259+
// 13. Open Project
184260
const openSelection = await window.showInformationMessage(
185261
'Project created successfully. Open it now?',
186262
'Open in New Window',

0 commit comments

Comments
 (0)