@@ -11,8 +11,8 @@ export class AppFilesUpdater {
11
11
) {
12
12
}
13
13
14
- public updateApp ( beforeCopyAction : ( sourceFiles : string [ ] ) => void , filesToSync ?: string [ ] ) : void {
15
- const sourceFiles = filesToSync || this . resolveAppSourceFiles ( ) ;
14
+ public updateApp ( beforeCopyAction : ( sourceFiles : string [ ] ) => void , projectData : IProjectData , filesToSync ?: string [ ] ) : void {
15
+ const sourceFiles = filesToSync || this . resolveAppSourceFiles ( projectData ) ;
16
16
17
17
beforeCopyAction ( sourceFiles ) ;
18
18
this . copyAppSourceFiles ( sourceFiles ) ;
@@ -41,15 +41,19 @@ export class AppFilesUpdater {
41
41
this . fs . deleteDirectory ( path . join ( this . appDestinationDirectoryPath , directoryItem ) ) ;
42
42
}
43
43
44
- protected readSourceDir ( ) : string [ ] {
44
+ protected readSourceDir ( projectData : IProjectData ) : string [ ] {
45
45
const tnsDir = path . join ( this . appSourceDirectoryPath , constants . TNS_MODULES_FOLDER_NAME ) ;
46
- const defaultAppResourcesDir = path . join ( this . appSourceDirectoryPath , constants . APP_RESOURCES_FOLDER_NAME ) ;
47
- return this . fs . enumerateFilesInDirectorySync ( this . appSourceDirectoryPath , null , { includeEmptyDirectories : true } ) . filter ( dirName => dirName !== tnsDir ) . filter ( dirName => ! dirName . startsWith ( defaultAppResourcesDir ) ) ;
46
+
47
+ return this . fs . enumerateFilesInDirectorySync ( this . appSourceDirectoryPath , null , { includeEmptyDirectories : true } ) . filter ( dirName => dirName !== tnsDir ) ;
48
48
}
49
49
50
- protected resolveAppSourceFiles ( ) : string [ ] {
51
- // Copy all files from app dir, but make sure to exclude tns_modules and App_Resources
52
- let sourceFiles = this . readSourceDir ( ) ;
50
+ protected resolveAppSourceFiles ( projectData : IProjectData ) : string [ ] {
51
+ if ( this . options . bundle ) {
52
+ return [ ] ;
53
+ }
54
+
55
+ // Copy all files from app dir, but make sure to exclude tns_modules and application resources
56
+ let sourceFiles = this . readSourceDir ( projectData ) ;
53
57
54
58
if ( this . options . release ) {
55
59
const testsFolderPath = path . join ( this . appSourceDirectoryPath , 'tests' ) ;
@@ -61,9 +65,11 @@ export class AppFilesUpdater {
61
65
constants . LIVESYNC_EXCLUDED_FILE_PATTERNS . forEach ( pattern => sourceFiles = sourceFiles . filter ( file => ! minimatch ( file , pattern , { nocase : true } ) ) ) ;
62
66
}
63
67
64
- if ( this . options . bundle ) {
65
- sourceFiles = sourceFiles . filter ( file => minimatch ( file , "**/App_Resources/**" , { nocase : true } ) ) ;
66
- }
68
+ // exclude the app_resources directory from being enumerated
69
+ // for copying if it is present in the application sources dir
70
+ const appResourcesPath = projectData . appResourcesDirectoryPath ;
71
+ sourceFiles = sourceFiles . filter ( dirName => ! path . normalize ( dirName ) . startsWith ( path . normalize ( appResourcesPath ) ) ) ;
72
+
67
73
return sourceFiles ;
68
74
}
69
75
0 commit comments