From 8d1c9d5f9afb79497e162e02a5d9e4d7c879411d Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Wed, 15 Feb 2017 17:33:57 -0800 Subject: [PATCH] Addressing CR comments --- src/harness/unittests/typingsInstaller.ts | 1 + src/services/jsTyping.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 9ead1c7167d..faffb3eb45c 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -731,6 +731,7 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { configuredProjects: 1 }); const p = projectService.configuredProjects[0]; checkProjectActualFiles(p, [app.path]); + checkWatchedFiles(host, [jsconfig.path, "/bower_components", "/node_modules"]); installer.installAll(/*expectedCount*/ 1); diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index a7bd5139da1..e22d4432774 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -218,7 +218,8 @@ namespace ts.JsTyping { const fileNames = host.readDirectory(packagesFolderPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); for (const fileName of fileNames) { const normalizedFileName = normalizePath(fileName); - if (getBaseFileName(normalizedFileName) !== "package.json") { + const baseFileName = getBaseFileName(normalizedFileName); + if (baseFileName !== "package.json" && baseFileName !== "bower.json") { continue; } const result = readConfigFile(normalizedFileName, (path: string) => host.readFile(path)); @@ -230,7 +231,7 @@ namespace ts.JsTyping { // npm 3's package.json contains a "_requiredBy" field // we should include all the top level module names for npm 2, and only module names whose // "_requiredBy" field starts with "#" or equals "/" for npm 3. - if (packageJson._requiredBy && + if (baseFileName === "package.json" && packageJson._requiredBy && filter(packageJson._requiredBy, (r: string) => r[0] === "#" || r === "/").length === 0) { continue; }