@@ -566,35 +566,21 @@ export default {
566566 // #region Format generator templates EOL for Windows
567567 let warnAboutEOL = false
568568 if ( isWindows ) {
569- // find unix2dos to help convert EOL, usually installed with git, ie: C:\Program Files\Git\usr\bin\unix2dos.EXE
570- const unixToDosPath = await system . exec ( "which unix2dos" )
571- // find all templates Ignite provides by default
572- const templates = filesystem . find ( `${ targetPath } /ignite/templates` , {
573- directories : false ,
574- files : true ,
575- matching : "*.ejs" ,
576- } )
577-
578- log ( `unix2dos path: ${ unixToDosPath } ` )
579- log ( `templates to change EOL: ${ templates } ` )
580- if ( unixToDosPath ) {
581- // running the output from `which` result above seems to not work, so just pop the binary name
582- const unixToDosCmd = unixToDosPath . split ( "/" ) . pop ( )
583- const results = await Promise . allSettled (
584- templates . map ( async ( file ) => {
585- log ( `Converting EOL for ${ file } ` )
586- await system . run ( `${ unixToDosCmd } ${ file } ` )
587- } ) ,
588- )
569+ try {
570+ const templates = filesystem . find ( `${ targetPath } /ignite/templates` , {
571+ directories : false ,
572+ files : true ,
573+ matching : "*.ejs" ,
574+ } )
589575
590- // inspect the results of conversion and log
591- results . forEach ( ( result ) => {
592- if ( result . status === "rejected" ) {
593- warnAboutEOL = true
594- log ( `Error converting EOL: ${ JSON . stringify ( result . reason ) } ` )
595- }
576+ log ( `templates to change EOL: ${ templates } ` )
577+ templates . map ( async ( file ) => {
578+ log ( `Converting EOL for ${ file } ` )
579+ let template = read ( file )
580+ template = template . replace ( / \n / g , "\r\n" )
581+ write ( file , template )
596582 } )
597- } else {
583+ } catch {
598584 warnAboutEOL = true
599585 }
600586 }
0 commit comments