From e6661194fb3a84cb03cd3900ecc8650d91c4f404 Mon Sep 17 00:00:00 2001 From: Artem Chivchalov Date: Fri, 16 Aug 2019 15:20:10 +0300 Subject: [PATCH] improve libs and plugins detection to work correctly without local package.json --- lib/atom-ternjs-server.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/atom-ternjs-server.js b/lib/atom-ternjs-server.js index 17a6285..e761492 100644 --- a/lib/atom-ternjs-server.js +++ b/lib/atom-ternjs-server.js @@ -322,9 +322,13 @@ export default class Server { } let found = - this.findFile(file, projectDir, path.resolve(this.distDir, 'defs')) || - resolveFrom(projectDir, `tern-${src[i]}`) - ; + this.findFile(file, projectDir, path.resolve(this.distDir, 'defs')); + + if (!found) { + try { + found = resolveFrom(projectDir, `tern-${src[i]}`); + } catch (e) {} + } if (!found) { @@ -367,9 +371,14 @@ export default class Server { } let found = - this.findFile(`${plugin}.js`, projectDir, path.resolve(this.distDir, 'plugin')) || - resolveFrom(projectDir, `tern-${plugin}`) - ; + this.findFile(`${plugin}.js`, projectDir, path.resolve(this.distDir, 'plugin')); + + if (!found) { + try { + resolveFrom(projectDir, `tern-${plugin}`) + } + catch (e) {} + } if (!found) {