Skip to content

Commit 75ad246

Browse files
authored
Merge pull request #3423 from NativeScript/sis0k0/watch-patterns-pass-platforms
refactor: provide platforms to before-watchPatterns hooks
2 parents 97d72e9 + 1c1b593 commit 75ad246

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/definitions/livesync.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,11 @@ interface IDebugLiveSyncService extends ILiveSyncService {
212212
/**
213213
* Method used to retrieve the glob patterns which CLI will watch for file changes. Defaults to the whole app directory.
214214
* @param {ILiveSyncInfo} liveSyncData Information needed for livesync - for example if bundle is passed or if a release build should be performed.
215+
* @param {IProjectData} projectData Project data.
216+
* @param {string[]} platforms Platforms to start the watcher for.
215217
* @returns {Promise<string[]>} The glob patterns.
216218
*/
217-
getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData): Promise<string[]>;
219+
getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData, platforms: string[]): Promise<string[]>;
218220

219221
/**
220222
* Prints debug information.

lib/services/livesync/livesync-service.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
290290
}
291291

292292
@hook('watchPatterns')
293-
public async getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData): Promise<string[]> {
294-
// liveSyncData is used by plugins that make use of the watchPatterns hook
293+
public async getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData, platforms: string[]): Promise<string[]> {
294+
// liveSyncData and platforms are used by plugins that make use of the watchPatterns hook
295295
return [projectData.getAppDirectoryRelativePath(), projectData.getAppResourcesRelativeDirectoryPath()];
296296
}
297297

@@ -525,7 +525,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
525525
}
526526

527527
private async startWatcher(projectData: IProjectData, liveSyncData: ILiveSyncInfo, platforms: string[]): Promise<void> {
528-
const patterns = await this.getWatcherPatterns(liveSyncData, projectData);
528+
const patterns = await this.getWatcherPatterns(liveSyncData, projectData, platforms);
529529

530530
if (liveSyncData.watchAllFiles) {
531531
const productionDependencies = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir);

0 commit comments

Comments
 (0)