Skip to content

Commit 68246f8

Browse files
committed
fix: add watchPatterns hook as some plugins relies on it
1 parent e6e0aad commit 68246f8

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

lib/controllers/prepare-controller.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,8 @@ export class PrepareController extends EventEmitter {
114114
return false;
115115
}
116116

117-
const patterns = [
118-
path.join(projectData.projectDir, PACKAGE_JSON_FILE_NAME),
119-
path.join(projectData.getAppDirectoryPath(), PACKAGE_JSON_FILE_NAME),
120-
path.join(projectData.getAppResourcesRelativeDirectoryPath(), platformData.normalizedPlatformName),
121-
`node_modules/**/platforms/${platformData.platformNameLowerCase}/`
122-
];
117+
const patterns = await this.getWatcherPatterns(platformData, projectData);
118+
123119
const watcherOptions: choki.WatchOptions = {
124120
ignoreInitial: true,
125121
cwd: projectData.projectDir,
@@ -143,6 +139,18 @@ export class PrepareController extends EventEmitter {
143139
return hasNativeChanges;
144140
}
145141

142+
@hook('watchPatterns')
143+
public async getWatcherPatterns(platformData: IPlatformData, projectData: IProjectData): Promise<string[]> {
144+
const patterns = [
145+
path.join(projectData.projectDir, PACKAGE_JSON_FILE_NAME),
146+
path.join(projectData.getAppDirectoryPath(), PACKAGE_JSON_FILE_NAME),
147+
path.join(projectData.getAppResourcesRelativeDirectoryPath(), platformData.normalizedPlatformName),
148+
`node_modules/**/platforms/${platformData.platformNameLowerCase}/`
149+
];
150+
151+
return patterns;
152+
}
153+
146154
private emitPrepareEvent(filesChangeEventData: IFilesChangeEventData) {
147155
if (this.isInitialPrepareReady) {
148156
this.emit(PREPARE_READY_EVENT_NAME, filesChangeEventData);

0 commit comments

Comments
 (0)