Skip to content

Commit 9a35f20

Browse files
committed
fix: add package.json files from nativescript plugins to watch patterns
Currently CLI respects the changes only in the followings package.json files: * package.json from app folder * package.json from root folder of the application The changes from package.json files form NS plugins are not respected as they are not added to the watch's patterns.
1 parent 3cabd7e commit 9a35f20

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/controllers/prepare-controller.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,19 @@ export class PrepareController extends EventEmitter {
149149

150150
@hook('watchPatterns')
151151
public async getWatcherPatterns(platformData: IPlatformData, projectData: IProjectData): Promise<string[]> {
152-
const pluginsNativeDirectories = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir)
153-
.filter(dep => dep.nativescript)
152+
const dependencies = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir)
153+
.filter(dep => dep.nativescript);
154+
const pluginsNativeDirectories = dependencies
154155
.map(dep => path.join(dep.directory, PLATFORMS_DIR_NAME, platformData.platformNameLowerCase));
156+
const pluginsPackageJsonFiles = dependencies.map(dep => path.join(dep.directory, PACKAGE_JSON_FILE_NAME));
155157

156158
const patterns = [
157159
path.join(projectData.projectDir, PACKAGE_JSON_FILE_NAME),
158160
path.join(projectData.getAppDirectoryPath(), PACKAGE_JSON_FILE_NAME),
159161
path.join(projectData.getAppResourcesRelativeDirectoryPath(), platformData.normalizedPlatformName),
160-
].concat(pluginsNativeDirectories);
162+
]
163+
.concat(pluginsNativeDirectories)
164+
.concat(pluginsPackageJsonFiles);
161165

162166
return patterns;
163167
}

0 commit comments

Comments
 (0)