From 476169231ccee44876b2ba6b5262b19af3fcc950 Mon Sep 17 00:00:00 2001 From: Kristina Koeva Date: Mon, 22 Aug 2016 14:54:31 +0300 Subject: [PATCH] Enable live edit on typescript projects When a typescript file is changed its js.map file is also changed which causes an app restart --- lib/services/livesync/ios-device-livesync-service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/services/livesync/ios-device-livesync-service.ts b/lib/services/livesync/ios-device-livesync-service.ts index 42b2b90721..13d0e6896c 100644 --- a/lib/services/livesync/ios-device-livesync-service.ts +++ b/lib/services/livesync/ios-device-livesync-service.ts @@ -1,4 +1,6 @@ import * as helpers from "../../common/helpers"; +import * as constants from "../../constants"; +import * as minimatch from "minimatch"; import * as net from "net"; import Future = require("fibers/future"); @@ -75,8 +77,11 @@ class IOSLiveSyncService implements IDeviceLiveSyncService { this.restartApplication(deviceAppData).wait(); return; } + let scriptRelatedFiles: Mobile.ILocalToDevicePathData[] = []; let scriptFiles = _.filter(localToDevicePaths, localToDevicePath => _.endsWith(localToDevicePath.getDevicePath(), ".js")); - let otherFiles = _.difference(localToDevicePaths, scriptFiles); + constants.LIVESYNC_EXCLUDED_FILE_PATTERNS.forEach(pattern => scriptRelatedFiles = _.concat(scriptRelatedFiles, localToDevicePaths.filter(file => minimatch(file.getDevicePath(), pattern, { nocase: true })))); + + let otherFiles = _.difference(localToDevicePaths, _.concat(scriptFiles, scriptRelatedFiles)); let shouldRestart = _.some(otherFiles, (localToDevicePath: Mobile.ILocalToDevicePathData) => !this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform)); if (shouldRestart) {