@@ -620,14 +620,14 @@ async function create(_argv: yargs.Arguments<any>) {
620620 year : new Date ( ) . getFullYear ( ) ,
621621 } ;
622622
623- const copyDir = async ( source : string , dest : string ) => {
624- await fs . mkdirp ( dest ) ;
623+ async function applyTemplate ( source : string , destination : string ) {
624+ await fs . mkdirp ( destination ) ;
625625
626626 const files = await fs . readdir ( source ) ;
627627
628628 for ( const f of files ) {
629629 const target = path . join (
630- dest ,
630+ destination ,
631631 ejs . render ( f . replace ( / ^ \$ / , '' ) , options , {
632632 openDelimiter : '{' ,
633633 closeDelimiter : '}' ,
@@ -638,7 +638,7 @@ async function create(_argv: yargs.Arguments<any>) {
638638 const stats = await fs . stat ( file ) ;
639639
640640 if ( stats . isDirectory ( ) ) {
641- await copyDir ( file , target ) ;
641+ await applyTemplate ( file , target ) ;
642642 } else if ( ! BINARIES . some ( ( r ) => r . test ( file ) ) ) {
643643 const content = await fs . readFile ( file , 'utf8' ) ;
644644
@@ -647,7 +647,7 @@ async function create(_argv: yargs.Arguments<any>) {
647647 await fs . copyFile ( file , target ) ;
648648 }
649649 }
650- } ;
650+ }
651651
652652 await fs . mkdirp ( folder ) ;
653653
@@ -687,47 +687,47 @@ async function create(_argv: yargs.Arguments<any>) {
687687 spinner . text = 'Copying files' ;
688688
689689 if ( local ) {
690- await copyDir ( COMMON_LOCAL_FILES , folder ) ;
690+ await applyTemplate ( COMMON_LOCAL_FILES , folder ) ;
691691 } else {
692- await copyDir ( COMMON_FILES , folder ) ;
692+ await applyTemplate ( COMMON_FILES , folder ) ;
693693
694694 if ( example !== 'none' ) {
695- await copyDir ( COMMON_EXAMPLE_FILES , folder ) ;
695+ await applyTemplate ( COMMON_EXAMPLE_FILES , folder ) ;
696696 }
697697 }
698698
699699 if ( languages === 'js' ) {
700- await copyDir ( JS_FILES , folder ) ;
701- await copyDir ( EXPO_FILES , folder ) ;
700+ await applyTemplate ( JS_FILES , folder ) ;
701+ await applyTemplate ( EXPO_FILES , folder ) ;
702702 } else {
703- await copyDir ( NATIVE_COMMON_FILES , folder ) ;
703+ await applyTemplate ( NATIVE_COMMON_FILES , folder ) ;
704704
705705 if ( example !== 'none' ) {
706- await copyDir ( NATIVE_COMMON_EXAMPLE_FILES , folder ) ;
706+ await applyTemplate ( NATIVE_COMMON_EXAMPLE_FILES , folder ) ;
707707 }
708708
709709 if ( moduleType === 'module' ) {
710- await copyDir ( NATIVE_FILES [ `${ moduleType } _${ arch } ` ] , folder ) ;
710+ await applyTemplate ( NATIVE_FILES [ `${ moduleType } _${ arch } ` ] , folder ) ;
711711 } else {
712- await copyDir ( NATIVE_FILES [ `${ moduleType } _${ arch } ` ] , folder ) ;
712+ await applyTemplate ( NATIVE_FILES [ `${ moduleType } _${ arch } ` ] , folder ) ;
713713 }
714714
715715 if ( options . project . swift ) {
716- await copyDir ( SWIFT_FILES [ `${ moduleType } _legacy` ] , folder ) ;
716+ await applyTemplate ( SWIFT_FILES [ `${ moduleType } _legacy` ] , folder ) ;
717717 } else {
718718 if ( moduleType === 'module' ) {
719- await copyDir ( OBJC_FILES [ `${ moduleType } _common` ] , folder ) ;
719+ await applyTemplate ( OBJC_FILES [ `${ moduleType } _common` ] , folder ) ;
720720 } else {
721- await copyDir ( OBJC_FILES [ `view_${ arch } ` ] , folder ) ;
721+ await applyTemplate ( OBJC_FILES [ `view_${ arch } ` ] , folder ) ;
722722 }
723723 }
724724
725725 const templateType = `${ moduleType } _${ arch } ` as const ;
726726
727- await copyDir ( KOTLIN_FILES [ templateType ] , folder ) ;
727+ await applyTemplate ( KOTLIN_FILES [ templateType ] , folder ) ;
728728
729729 if ( options . project . cpp ) {
730- await copyDir ( CPP_FILES , folder ) ;
730+ await applyTemplate ( CPP_FILES , folder ) ;
731731 await fs . remove ( path . join ( folder , 'ios' , `${ options . project . name } .m` ) ) ;
732732 }
733733 }
0 commit comments