From 1c1b59385e786cc459e9a963fc6f00b4bfd4cb74 Mon Sep 17 00:00:00 2001 From: sis0k0 Date: Tue, 6 Mar 2018 15:06:45 +0200 Subject: [PATCH] refactor: provide platforms to before-watchPatterns hooks --- lib/definitions/livesync.d.ts | 4 +++- lib/services/livesync/livesync-service.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/definitions/livesync.d.ts b/lib/definitions/livesync.d.ts index 28cb3fa370..9a69ffed78 100644 --- a/lib/definitions/livesync.d.ts +++ b/lib/definitions/livesync.d.ts @@ -212,9 +212,11 @@ interface IDebugLiveSyncService extends ILiveSyncService { /** * Method used to retrieve the glob patterns which CLI will watch for file changes. Defaults to the whole app directory. * @param {ILiveSyncInfo} liveSyncData Information needed for livesync - for example if bundle is passed or if a release build should be performed. + * @param {IProjectData} projectData Project data. + * @param {string[]} platforms Platforms to start the watcher for. * @returns {Promise} The glob patterns. */ - getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData): Promise; + getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData, platforms: string[]): Promise; /** * Prints debug information. diff --git a/lib/services/livesync/livesync-service.ts b/lib/services/livesync/livesync-service.ts index d5a6d95f1d..8f133e22ab 100644 --- a/lib/services/livesync/livesync-service.ts +++ b/lib/services/livesync/livesync-service.ts @@ -290,8 +290,8 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi } @hook('watchPatterns') - public async getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData): Promise { - // liveSyncData is used by plugins that make use of the watchPatterns hook + public async getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData, platforms: string[]): Promise { + // liveSyncData and platforms are used by plugins that make use of the watchPatterns hook return [projectData.getAppDirectoryRelativePath(), projectData.getAppResourcesRelativeDirectoryPath()]; } @@ -525,7 +525,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi } private async startWatcher(projectData: IProjectData, liveSyncData: ILiveSyncInfo, platforms: string[]): Promise { - const patterns = await this.getWatcherPatterns(liveSyncData, projectData); + const patterns = await this.getWatcherPatterns(liveSyncData, projectData, platforms); if (liveSyncData.watchAllFiles) { const productionDependencies = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir);