@@ -157,20 +157,22 @@ export class PlatformService implements IPlatformService {
157157 let contents = this . $fs . readDirectory ( appDestinationDirectoryPath ) . wait ( ) ;
158158
159159 _ ( contents )
160- . filter ( directoryName => directoryName !== "tns_modules" )
160+ . filter ( directoryName => directoryName !== constants . TNS_MODULES_FOLDER_NAME )
161161 . each ( directoryName => this . $fs . deleteDirectory ( path . join ( appDestinationDirectoryPath , directoryName ) ) . wait ( ) )
162162 . value ( ) ;
163163
164164 // Copy all files from app dir, but make sure to exclude tns_modules
165165 let sourceFiles = this . $fs . readDirectory ( appSourceDirectoryPath ) . wait ( ) ;
166- if ( _ . contains ( sourceFiles , "tns_modules" ) ) {
167- this . $logger . warn ( "You have tns_modules dir in your app folder. It will not be used and you can safely remove it." ) ;
166+ let hasTnsModulesInAppFolder = _ . contains ( sourceFiles , constants . TNS_MODULES_FOLDER_NAME ) ;
167+ if ( hasTnsModulesInAppFolder && this . $projectData . dependencies && this . $projectData . dependencies [ constants . TNS_CORE_MODULES_NAME ] ) {
168+ this . $logger . warn ( "You have tns_modules dir in your app folder and tns-core-modules in your package.json file. Tns_modules dir in your app folder will not be used and you can safely remove it." ) ;
169+ sourceFiles . filter ( source => source !== constants . TNS_MODULES_FOLDER_NAME )
170+ . map ( source => path . join ( appSourceDirectoryPath , source ) )
171+ . forEach ( source => shell . cp ( "-Rf" , source , appDestinationDirectoryPath ) ) ;
172+ } else {
173+ shell . cp ( "-Rf" , path . join ( appSourceDirectoryPath , "*" ) , appDestinationDirectoryPath ) ;
168174 }
169175
170- sourceFiles . filter ( source => source !== "tns_modules" )
171- . map ( source => path . join ( appSourceDirectoryPath , source ) )
172- . forEach ( source => shell . cp ( "-Rf" , source , appDestinationDirectoryPath ) ) ;
173-
174176 // Copy App_Resources to project root folder
175177 this . $fs . ensureDirectoryExists ( platformData . platformProjectService . getAppResourcesDestinationDirectoryPath ( ) . wait ( ) ) . wait ( ) ; // Should be deleted
176178 let appResourcesDirectoryPath = path . join ( appDestinationDirectoryPath , constants . APP_RESOURCES_FOLDER_NAME ) ;
0 commit comments