From 98088a27e12b3f9cf01004ebe1fa1afded327b84 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Tue, 28 Jul 2020 10:46:51 +0200 Subject: [PATCH 1/2] fix for linked plugins in case of plugins like file:../../plugin it would fail because pkgdir is the plugin actual dir which is not "inside" the app project folder. --- index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6cccf7e..7fac369 100644 --- a/index.js +++ b/index.js @@ -69,9 +69,15 @@ function forEachHook(pkgdir, callback) { } var projectDir = findProjectDir(pkgdir); - if (!projectDir) { - return; - } + if (!projectDir) { + // in case of plugins like file:../../plugin it would fail because + // pkgdir is the plugin actual dir which is not "inside" the app project folder. + if (_isNativeScriptAppRoot(process.cwd())) { + projectDir = process.cwd(); + } else { + return; + } + } var hooksDir = path.join(projectDir, 'hooks'); if (ns.hooks) { From 31c2ca375b19d734d67e8fc6747f88600395cc86 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Tue, 28 Jul 2020 10:48:05 +0200 Subject: [PATCH 2/2] lint fix --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 7fac369..2b3db2c 100644 --- a/index.js +++ b/index.js @@ -69,15 +69,15 @@ function forEachHook(pkgdir, callback) { } var projectDir = findProjectDir(pkgdir); - if (!projectDir) { + if (!projectDir) { // in case of plugins like file:../../plugin it would fail because // pkgdir is the plugin actual dir which is not "inside" the app project folder. - if (_isNativeScriptAppRoot(process.cwd())) { - projectDir = process.cwd(); - } else { - return; - } - } + if (_isNativeScriptAppRoot(process.cwd())) { + projectDir = process.cwd(); + } else { + return; + } + } var hooksDir = path.join(projectDir, 'hooks'); if (ns.hooks) {