Skip to content

Commit

Permalink
feat: support nuxt3 minimal starter
Browse files Browse the repository at this point in the history
  • Loading branch information
yrming committed Dec 28, 2023
1 parent ebe9546 commit 07e37b7
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</p>

<p align="center">
Create a project quickly and easily in VSCode
Kickstart your project with a Starter Template in VSCode
</p>

## Why
Expand All @@ -17,12 +17,12 @@ Create a project quickly and easily in VSCode
- [Create Vue](https://github.com/vuejs/create-vue) - The recommended way to start a Vite-powered Vue project.
- [Vitesse](https://github.com/antfu/vitesse) - Opinionated starter template.
- [Vitesse Lite](https://github.com/antfu/vitesse-lite) - Lightweight version of Vitesse.
- [Nuxt3 Minimal Starter](https://github.com/nuxt/starter/tree/v3) - Create a new Nuxt project, module, layer or start from a theme with our collection of starters.
- [Vitesse Nuxt3](https://github.com/antfu/vitesse-nuxt3) - Vitesse for Nuxt 3.
- [Vitesse WebExt](https://github.com/antfu/vitesse-webext) - WebExtension Vite Starter Template.
- [Starter TS](https://github.com/antfu/starter-ts) - Starter template for TypeScript library.
- ...


## License

MIT License © 2023 [YRM](https://github.com/yrming)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 31 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"publisher": "YRM",
"name": "starter-templates",
"displayName": "Starter Templates",
"version": "0.1.6",
"description": "Create a project quickly and easily in VSCode",
"version": "0.2.0",
"description": "Kickstart your project with a Starter Template in VSCode",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -89,6 +89,35 @@
"scope": "window"
}
}
},
{
"title": "Nuxt3 Minimal Starter(Official)",
"order": 2,
"properties": {
"starterTemplates.nuxt3MinimalStarter.needsGitInit": {
"type": "boolean",
"default": true,
"markdownDescription": "Initialize git repository",
"scope": "window"
},
"starterTemplates.nuxt3MinimalStarter.needsInstall": {
"type": "boolean",
"default": true,
"markdownDescription": "Install project dependencies",
"scope": "window"
},
"starterTemplates.nuxt3MinimalStarter.packageManager": {
"enum": [
"pnpm",
"npm",
"yarn",
"bun"
],
"default": "pnpm",
"description": "Package manager choice",
"scope": "window"
}
}
}
]
},
Expand Down
46 changes: 38 additions & 8 deletions src/commands/starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export class StarterCommands extends BaseCommands {
break
case 'vitesse-lite':
await degit('antfu/vitesse-lite').clone(`${projectPath}`)
break
case 'nuxt3-minimal-starter':
await degit('nuxt/starter/#v3').clone(`${projectPath}`)

break
case 'vitesse-nuxt3':
await degit('antfu/vitesse-nuxt3').clone(`${projectPath}`)
Expand Down Expand Up @@ -127,11 +131,11 @@ export class StarterCommands extends BaseCommands {
kind: QuickPickItemKind.Separator,
label: 'Nuxt',
},
// {
// label: "Nuxi(Official)",
// detail: "⚡️ Nuxt Generation CLI Experience",
// template: { id: "nuxi", defaultProjectName: 'nuxt-project' },
// },
{
label: 'Nuxt3 Minimal Starter(Official)',
detail: 'Create a new Nuxt project, module, layer or start from a theme with our collection of starters.',
template: { id: 'nuxt3-minimal-starter', defaultProjectName: 'nuxt-project' },
},
{
label: 'Vitesse Nuxt3(Anthony Fu)',
detail: 'Vitesse for Nuxt 3 🏔💚⚡️',
Expand Down Expand Up @@ -203,7 +207,7 @@ export class StarterCommands extends BaseCommands {
title: 'Project Name',
validation: s => this.validateProjectName(s, folderPath),
value: defaultName,
enableSetting: template.id === 'create-vue',
enableSetting: template.id === 'create-vue' || template.id === 'nuxt3-minimal-starter',
},
)

Expand Down Expand Up @@ -304,9 +308,35 @@ export class StarterCommands extends BaseCommands {
},
)
}

return createVueSettings

case 'nuxt3-minimal-starter':
return [
{
currentValue: config.nuxt3MinimalStarterNeedsGitInit ? 'Yes' : 'No',
description: config.nuxt3MinimalStarterNeedsGitInit ? 'Yes' : 'No',
detail: '',
label: 'Initialize git repository?',
setValue: (newValue: boolean) => config.setNuxt3MinimalStarterNeedsGitInit(newValue),
settingKind: 'BOOL',
},
{
currentValue: config.nuxt3MinimalStarterNeedsInstall ? 'Yes' : 'No',
description: config.nuxt3MinimalStarterNeedsInstall ? 'Yes' : 'No',
detail: '',
label: 'Install project dependencies?',
setValue: (newValue: boolean) => config.setNuxt3MinimalStarterNeedsInstall(newValue),
settingKind: 'BOOL',
},
{
currentValue: config.nuxt3MinimalStarterPackageManager || 'pnpm',
description: config.nuxt3MinimalStarterPackageManager || 'pnpm',
detail: '',
enumValues: ['pnpm', 'npm', 'yarn', 'bun'],
label: 'Package manager choice?',
setValue: (newValue: 'pnpm' | 'npm' | 'yarn' | 'bun') => config.setNuxt3MinimalStarterPackageManager(newValue),
settingKind: 'ENUM',
},
]
default:
return []
}
Expand Down
10 changes: 10 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Config {

get projectSearchDepth(): number { return this.getConfig<number>('projectSearchDepth', 5) }

// create vue
get createVueNeedsTypeScript(): boolean { return this.getConfig<boolean>('createVue.needsTypeScript', true) }
get createVueNeedsJsx(): boolean { return this.getConfig<boolean>('createVue.needsJsx', true) }
get createVueNeedsRouter(): boolean { return this.getConfig<boolean>('createVue.needsRouter', true) }
Expand All @@ -46,7 +47,12 @@ class Config {
get createVueEndToEndTestingSolution(): 'Cypress' | 'Nightwatch' | 'Playwright' | 'No' { return this.getConfig<'Cypress' | 'Nightwatch' | 'Playwright' | 'No'>('createVue.endToEndTestingSolution', 'Cypress') }
get createVueNeedsEslint(): boolean { return this.getConfig<boolean>('createVue.needsEslint', true) }
get createVueNeedsPrettier(): boolean { return this.getConfig<boolean>('createVue.needsPrettier', true) }
// nuxt3 minimal starter
get nuxt3MinimalStarterNeedsGitInit(): boolean { return this.getConfig<boolean>('nuxt3MinimalStarter.needsGitInit', true) }
get nuxt3MinimalStarterNeedsInstall(): boolean { return this.getConfig<boolean>('nuxt3MinimalStarter.needsInstall', true) }
get nuxt3MinimalStarterPackageManager(): 'pnpm' | 'npm' | 'yarn' | 'bun' { return this.getConfig<'pnpm' | 'npm' | 'yarn' | 'bun'>('nuxt3MinimalStarter.packageManager', 'pnpm') }

// create vue
public setCreateVueNeedsTypeScript(value: boolean): Promise<void> { return this.setConfig('createVue.needsTypeScript', value, ConfigurationTarget.Global) }
public setCreateVueNeedsJsx(value: boolean): Promise<void> { return this.setConfig('createVue.needsJsx', value, ConfigurationTarget.Global) }
public setCreateVueNeedsRouter(value: boolean): Promise<void> { return this.setConfig('createVue.needsRouter', value, ConfigurationTarget.Global) }
Expand All @@ -55,6 +61,10 @@ class Config {
public setCreateVueEndToEndTestingSolution(value: 'Cypress' | 'Nightwatch' | 'Playwright' | 'No'): Promise<void> { return this.setConfig('createVue.endToEndTestingSolution', value, ConfigurationTarget.Global) }
public setCreateVueNeedsEslint(value: boolean): Promise<void> { return this.setConfig('createVue.needsEslint', value, ConfigurationTarget.Global) }
public setCreateVueNeedsPrettier(value: boolean): Promise<void> { return this.setConfig('createVue.needsPrettier', value, ConfigurationTarget.Global) }
// nuxt3 minimal starter
public setNuxt3MinimalStarterNeedsGitInit(value: boolean): Promise<void> { return this.setConfig('nuxt3MinimalStarter.needsGitInit', value, ConfigurationTarget.Global) }
public setNuxt3MinimalStarterNeedsInstall(value: boolean): Promise<void> { return this.setConfig('nuxt3MinimalStarter.needsInstall', value, ConfigurationTarget.Global) }
public setNuxt3MinimalStarterPackageManager(value: 'pnpm' | 'npm' | 'yarn' | 'bun'): Promise<void> { return this.setConfig('nuxt3MinimalStarter.packageManager', value, ConfigurationTarget.Global) }

public for(uri?: Uri): ResourceConfig {
return new ResourceConfig(uri)
Expand Down

0 comments on commit 07e37b7

Please sign in to comment.