@@ -406,7 +406,12 @@ export async function fetchAllResolvedItems(
406406 * @returns
407407 */
408408export async function getItemLocation (
409- item : { name : string ; type : RegistryItemType ; files : { path : string ; target ?: string } [ ] } ,
409+ item : {
410+ name : string ;
411+ type : RegistryItemType ;
412+ files : { path : string ; target ?: string } [ ] ;
413+ registry : ResolvedRegistry ;
414+ } ,
410415 {
411416 paths,
412417 nonInteractive,
@@ -427,26 +432,28 @@ export async function getItemLocation(
427432 } ) ;
428433 }
429434
430- const defaultPath = paths [ '*' ] ;
435+ const catchAllPath = paths [ '*' ] ;
431436 const type = normalizeItemTypeForPath ( item . type ) ;
432437 const path = paths [ type ] ;
433438 if ( ! path ) {
434- if ( defaultPath ) {
439+ if ( catchAllPath ) {
435440 return ok ( {
436- path : defaultPath ,
441+ path : catchAllPath ,
437442 // already resolved
438- resolvedPath : defaultPath ,
443+ resolvedPath : catchAllPath ,
439444 } ) ;
440445 }
441446
442447 // we just error in non-interactive mode
443448 if ( nonInteractive ) return err ( new NoPathProvidedError ( { item : item . name , type } ) ) ;
444449
450+ const defaultPath = item . registry . manifest . defaultPaths ?. [ type ] ?? `./src/${ type } ` ;
451+
445452 const blocksPath = await text ( {
446453 message : `Where would you like to add ${ pc . cyan ( type ) } ?` ,
447- placeholder : `./src/ ${ type } ` ,
448- initialValue : `./src/ ${ type } ` ,
449- defaultValue : `./src/ ${ type } ` ,
454+ placeholder : defaultPath ,
455+ initialValue : defaultPath ,
456+ defaultValue : defaultPath ,
450457 validate ( value ) {
451458 if ( ! value || value . trim ( ) === '' ) return 'Please provide a value' ;
452459 } ,
@@ -664,6 +671,7 @@ export async function getPathsForItems({
664671 name : string ;
665672 type : RegistryItemType ;
666673 files : { path : ItemRelativePath ; type : RegistryItemType ; target ?: string } [ ] ;
674+ registry : ResolvedRegistry ;
667675 } [ ] ;
668676 config : Config | undefined ;
669677 options : { cwd : AbsolutePath ; yes : boolean } ;
0 commit comments