@@ -11,9 +11,9 @@ export class AppFilesUpdater {
1111 ) {
1212 }
1313
14- public updateApp ( updateAppOptions : IUpdateAppOptions ) : void {
14+ public updateApp ( updateAppOptions : IUpdateAppOptions , projectData : IProjectData ) : void {
1515 this . cleanDestinationApp ( updateAppOptions ) ;
16- const sourceFiles = updateAppOptions . filesToSync || this . resolveAppSourceFiles ( ) ;
16+ const sourceFiles = updateAppOptions . filesToSync || this . resolveAppSourceFiles ( projectData ) ;
1717
1818 updateAppOptions . beforeCopyAction ( sourceFiles ) ;
1919 this . copyAppSourceFiles ( sourceFiles ) ;
@@ -52,15 +52,19 @@ export class AppFilesUpdater {
5252 this . fs . deleteDirectory ( path . join ( this . appDestinationDirectoryPath , directoryItem ) ) ;
5353 }
5454
55- protected readSourceDir ( ) : string [ ] {
55+ protected readSourceDir ( projectData : IProjectData ) : string [ ] {
5656 const tnsDir = path . join ( this . appSourceDirectoryPath , constants . TNS_MODULES_FOLDER_NAME ) ;
57- const defaultAppResourcesDir = path . join ( this . appSourceDirectoryPath , constants . APP_RESOURCES_FOLDER_NAME ) ;
58- return this . fs . enumerateFilesInDirectorySync ( this . appSourceDirectoryPath , null , { includeEmptyDirectories : true } ) . filter ( dirName => dirName !== tnsDir ) . filter ( dirName => ! dirName . startsWith ( defaultAppResourcesDir ) ) ;
57+
58+ return this . fs . enumerateFilesInDirectorySync ( this . appSourceDirectoryPath , null , { includeEmptyDirectories : true } ) . filter ( dirName => dirName !== tnsDir ) ;
5959 }
6060
61- protected resolveAppSourceFiles ( ) : string [ ] {
62- // Copy all files from app dir, but make sure to exclude tns_modules and App_Resources
63- let sourceFiles = this . readSourceDir ( ) ;
61+ protected resolveAppSourceFiles ( projectData : IProjectData ) : string [ ] {
62+ if ( this . options . bundle ) {
63+ return [ ] ;
64+ }
65+
66+ // Copy all files from app dir, but make sure to exclude tns_modules and application resources
67+ let sourceFiles = this . readSourceDir ( projectData ) ;
6468
6569 if ( this . options . release ) {
6670 const testsFolderPath = path . join ( this . appSourceDirectoryPath , 'tests' ) ;
@@ -72,9 +76,11 @@ export class AppFilesUpdater {
7276 constants . LIVESYNC_EXCLUDED_FILE_PATTERNS . forEach ( pattern => sourceFiles = sourceFiles . filter ( file => ! minimatch ( file , pattern , { nocase : true } ) ) ) ;
7377 }
7478
75- if ( this . options . bundle ) {
76- sourceFiles = sourceFiles . filter ( file => minimatch ( file , "**/App_Resources/**" , { nocase : true } ) ) ;
77- }
79+ // exclude the app_resources directory from being enumerated
80+ // for copying if it is present in the application sources dir
81+ const appResourcesPath = projectData . appResourcesDirectoryPath ;
82+ sourceFiles = sourceFiles . filter ( dirName => ! path . normalize ( dirName ) . startsWith ( path . normalize ( appResourcesPath ) ) ) ;
83+
7884 return sourceFiles ;
7985 }
8086
0 commit comments