Skip to content

Commit 92f19b2

Browse files
Do not copy tns_modules from app dir
In case there's tns_modules in app directory, they are copied on each prepare. Skip tns_modules as they are now installed as npm dependency. Warn the user that the tns_modules from app will not be used. Fixes #854
1 parent 16647fc commit 92f19b2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/services/platform-service.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,16 @@ export class PlatformService implements IPlatformService {
160160
.filter(directoryName => directoryName !== "tns_modules")
161161
.each(directoryName => this.$fs.deleteDirectory(path.join(appDestinationDirectoryPath, directoryName)).wait())
162162
.value();
163-
shell.cp("-Rf", appSourceDirectoryPath, platformData.appDestinationDirectoryPath);
163+
164+
// Copy all files from app dir, but make sure to exclude tns_modules
165+
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.");
168+
}
169+
170+
sourceFiles.filter(source => source !== "tns_modules")
171+
.map(source => path.join(appSourceDirectoryPath, source))
172+
.forEach(source => shell.cp("-Rf", source, appDestinationDirectoryPath));
164173

165174
// Copy App_Resources to project root folder
166175
this.$fs.ensureDirectoryExists(platformData.platformProjectService.getAppResourcesDestinationDirectoryPath().wait()).wait(); // Should be deleted

0 commit comments

Comments
 (0)