Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/services/livesync/platform-livesync-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export abstract class PlatformLiveSyncServiceBase {
const mappedFiles = _.map(filesToSync, filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData));

// Some plugins modify platforms dir on afterPrepare (check nativescript-dev-sass) - we want to sync only existing file.
const existingFiles = mappedFiles.filter(m => this.$fs.exists(m));
const existingFiles = mappedFiles.filter(m => m && this.$fs.exists(m));
this.$logger.trace("Will execute livesync for files: ", existingFiles);
const skippedFiles = _.difference(mappedFiles, existingFiles);
if (skippedFiles.length) {
Expand All @@ -75,7 +75,7 @@ export abstract class PlatformLiveSyncServiceBase {
const platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData);
const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME);
const localToDevicePaths = await this.$projectFilesManager.createLocalToDevicePaths(deviceAppData,
projectFilesPath, mappedFiles, []);
projectFilesPath, existingFiles, []);
modifiedLocalToDevicePaths.push(...localToDevicePaths);
await this.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, false);
}
Expand All @@ -85,7 +85,10 @@ export abstract class PlatformLiveSyncServiceBase {
const filePaths = liveSyncInfo.filesToRemove;
const platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData);

const mappedFiles = _.map(filePaths, filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData));
const mappedFiles = _(filePaths)
.map(filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData))
.filter(filePath => !!filePath)
.value();
const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME);
const localToDevicePaths = await this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, projectFilesPath, mappedFiles, []);
modifiedLocalToDevicePaths.push(...localToDevicePaths);
Expand Down