Skip to content

refactor: provide platforms to before-watchPatterns hooks #3423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2018
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
4 changes: 3 additions & 1 deletion lib/definitions/livesync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string[]>} The glob patterns.
*/
getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData): Promise<string[]>;
getWatcherPatterns(liveSyncData: ILiveSyncInfo, projectData: IProjectData, platforms: string[]): Promise<string[]>;

/**
* Prints debug information.
Expand Down
6 changes: 3 additions & 3 deletions lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
}

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

Expand Down Expand Up @@ -525,7 +525,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
}

private async startWatcher(projectData: IProjectData, liveSyncData: ILiveSyncInfo, platforms: string[]): Promise<void> {
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);
Expand Down