@@ -18,6 +18,7 @@ import generateReadme from './utils/generateReadme'
1818import getCommand from './utils/getCommand'
1919import getLanguage from './utils/getLanguage'
2020import renderEslint from './utils/renderEslint'
21+ import trimBoilerplate from './utils/trimBoilerplate'
2122
2223function isValidPackageName ( projectName ) {
2324 return / ^ (?: @ [ a - z 0 - 9 - * ~ ] [ a -z 0 -9 -* ._ ~ ] * \/ ) ? [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * $ / . test ( projectName )
@@ -72,7 +73,6 @@ async function init() {
7273 const cwd = process . cwd ( )
7374 // possible options:
7475 // --default
75- // --minimal
7676 // --typescript / --ts
7777 // --jsx
7878 // --router / --vue-router
@@ -85,6 +85,7 @@ async function init() {
8585 // --eslint
8686 // --eslint-with-prettier (only support prettier through eslint for simplicity)
8787 // --force (for force overwriting)
88+ // --bare (for a barebone template)
8889
8990 const args = process . argv . slice ( 2 )
9091
@@ -108,7 +109,6 @@ async function init() {
108109 const isFeatureFlagsUsed =
109110 typeof (
110111 argv . default ??
111- argv . minimal ??
112112 ( argv . ts || argv . typescript ) ??
113113 argv . jsx ??
114114 ( argv . router || argv [ 'vue-router' ] ) ??
@@ -321,8 +321,8 @@ async function init() {
321321 packageName = projectName ?? defaultProjectName ,
322322 shouldOverwrite = argv . force ,
323323 needsJsx = argv . jsx ,
324- needsTypeScript = argv . ts || argv . typescript ,
325- needsRouter = argv . router || argv [ 'vue-router' ] ,
324+ needsTypeScript = ( argv . ts || argv . typescript ) as boolean ,
325+ needsRouter = ( argv . router || argv [ 'vue-router' ] ) as boolean ,
326326 needsPinia = argv . pinia ,
327327 needsVitest = argv . vitest || argv . tests ,
328328 needsPrettier = argv [ 'eslint-with-prettier' ] ,
@@ -565,29 +565,8 @@ async function init() {
565565 )
566566 }
567567
568- if ( argv . minimal ) {
569- // Only keep `src/App.vue` and `src/main.js` inside the `src` folder
570- postOrderDirectoryTraverse (
571- path . resolve ( root , 'src' ) ,
572- ( dir ) => {
573- if ( path . basename ( dir ) === 'src' ) {
574- return
575- }
576- fs . rmdirSync ( dir )
577- } ,
578- ( filepath ) => {
579- if ( ! [ 'App.vue' , 'main.js' ] . includes ( path . basename ( filepath ) ) ) fs . unlinkSync ( filepath )
580- } ,
581- )
582- // Replace the content in `src/App.vue` with a minimal template
583- fs . writeFileSync (
584- path . resolve ( root , 'src/App.vue' ) ,
585- '<script setup>\n</script>\n\n<template>\n <h1>Hello World</h1>\n</template>\n\n<style scoped>\n</style>\n' ,
586- )
587- // Remove CSS import in `src/main.js`
588- const srcMainJsPath = path . resolve ( root , 'src/main.js' )
589- const srcMainJsContent = fs . readFileSync ( srcMainJsPath , 'utf8' )
590- fs . writeFileSync ( srcMainJsPath , srcMainJsContent . replace ( "import './assets/main.css'\n\n" , '' ) )
568+ if ( argv . bare ) {
569+ trimBoilerplate ( root , { needsTypeScript, needsRouter } )
591570 }
592571
593572 // Instructions:
0 commit comments