@@ -18,6 +18,7 @@ import generateReadme from './utils/generateReadme'
18
18
import getCommand from './utils/getCommand'
19
19
import getLanguage from './utils/getLanguage'
20
20
import renderEslint from './utils/renderEslint'
21
+ import trimBoilerplate from './utils/trimBoilerplate'
21
22
22
23
function isValidPackageName ( projectName ) {
23
24
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() {
72
73
const cwd = process . cwd ( )
73
74
// possible options:
74
75
// --default
75
- // --minimal
76
76
// --typescript / --ts
77
77
// --jsx
78
78
// --router / --vue-router
@@ -85,6 +85,7 @@ async function init() {
85
85
// --eslint
86
86
// --eslint-with-prettier (only support prettier through eslint for simplicity)
87
87
// --force (for force overwriting)
88
+ // --bare (for a barebone template)
88
89
89
90
const args = process . argv . slice ( 2 )
90
91
@@ -108,7 +109,6 @@ async function init() {
108
109
const isFeatureFlagsUsed =
109
110
typeof (
110
111
argv . default ??
111
- argv . minimal ??
112
112
( argv . ts || argv . typescript ) ??
113
113
argv . jsx ??
114
114
( argv . router || argv [ 'vue-router' ] ) ??
@@ -321,8 +321,8 @@ async function init() {
321
321
packageName = projectName ?? defaultProjectName ,
322
322
shouldOverwrite = argv . force ,
323
323
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 ,
326
326
needsPinia = argv . pinia ,
327
327
needsVitest = argv . vitest || argv . tests ,
328
328
needsPrettier = argv [ 'eslint-with-prettier' ] ,
@@ -565,29 +565,8 @@ async function init() {
565
565
)
566
566
}
567
567
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 } )
591
570
}
592
571
593
572
// Instructions:
0 commit comments