From 9a35f200f0afc87be6d08b029bdaeb68a0017e5b Mon Sep 17 00:00:00 2001 From: fatme Date: Mon, 1 Jul 2019 00:15:12 +0300 Subject: [PATCH] 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. --- lib/controllers/prepare-controller.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/controllers/prepare-controller.ts b/lib/controllers/prepare-controller.ts index 52c1eec584..440be46ceb 100644 --- a/lib/controllers/prepare-controller.ts +++ b/lib/controllers/prepare-controller.ts @@ -149,15 +149,19 @@ export class PrepareController extends EventEmitter { @hook('watchPatterns') public async getWatcherPatterns(platformData: IPlatformData, projectData: IProjectData): Promise { - const pluginsNativeDirectories = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir) - .filter(dep => dep.nativescript) + const dependencies = this.$nodeModulesDependenciesBuilder.getProductionDependencies(projectData.projectDir) + .filter(dep => dep.nativescript); + const pluginsNativeDirectories = dependencies .map(dep => path.join(dep.directory, PLATFORMS_DIR_NAME, platformData.platformNameLowerCase)); + const pluginsPackageJsonFiles = dependencies.map(dep => path.join(dep.directory, PACKAGE_JSON_FILE_NAME)); const patterns = [ path.join(projectData.projectDir, PACKAGE_JSON_FILE_NAME), path.join(projectData.getAppDirectoryPath(), PACKAGE_JSON_FILE_NAME), path.join(projectData.getAppResourcesRelativeDirectoryPath(), platformData.normalizedPlatformName), - ].concat(pluginsNativeDirectories); + ] + .concat(pluginsNativeDirectories) + .concat(pluginsPackageJsonFiles); return patterns; }