File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ if (!command || command === 'dev') {
54
54
} )
55
55
} else if ( command === 'init' ) {
56
56
createLogger ( ) . info ( '' , { clear : true } )
57
- init ( )
57
+ init ( argv . root )
58
58
} else {
59
59
logVersion ( )
60
60
if ( command === 'build' ) {
Original file line number Diff line number Diff line change @@ -33,19 +33,22 @@ const getPackageManger = () => {
33
33
return name . split ( '/' ) [ 0 ]
34
34
}
35
35
36
- export async function init ( ) {
36
+ export async function init ( root : string | undefined ) {
37
37
intro ( bold ( cyan ( 'Welcome to VitePress!' ) ) )
38
38
39
39
const options : ScaffoldOptions = await group (
40
40
{
41
- root : ( ) =>
42
- text ( {
41
+ root : async ( ) => {
42
+ if ( root ) return root
43
+
44
+ return text ( {
43
45
message : 'Where should VitePress initialize the config?' ,
44
46
initialValue : './' ,
45
47
validate ( value ) {
46
48
// TODO make sure directory is inside
47
49
}
48
- } ) ,
50
+ } )
51
+ } ,
49
52
50
53
title : ( ) =>
51
54
text ( {
You can’t perform that action at this time.
0 commit comments