From 1681e0481f8df03850c35393023cde23a9c5c73d Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 28 Jun 2017 18:58:43 +0200 Subject: [PATCH 1/2] Allow node_modules parent folders if init script is an absolute path --- src/es6-init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/es6-init.js b/src/es6-init.js index 122878a..50e9dae 100644 --- a/src/es6-init.js +++ b/src/es6-init.js @@ -10,7 +10,7 @@ function findPackageJson(initScript) { // Walk up the parent directories until we find package.json. Make sure that // we're not actually stumbling upon a parent npm package let ret = path.join(initScript, 'package.json') - if (fs.statSyncNoException(ret) && !path.resolve(path.dirname(ret), '..').match(/[\\\/]node_modules$/i)) { + if (_fs2.default.statSyncNoException(ret) && (initScript.startsWith("/") || !_path2.default.resolve(_path2.default.dirname(ret), '..').match(/[\\\/]node_modules$/i))) { return ret; } From 58d6743f9136965f50cf019c0a503f3a689bde7f Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 28 Jun 2017 19:20:02 +0200 Subject: [PATCH 2/2] Fix fs and path module references --- src/es6-init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/es6-init.js b/src/es6-init.js index 50e9dae..0ac46cc 100644 --- a/src/es6-init.js +++ b/src/es6-init.js @@ -10,7 +10,7 @@ function findPackageJson(initScript) { // Walk up the parent directories until we find package.json. Make sure that // we're not actually stumbling upon a parent npm package let ret = path.join(initScript, 'package.json') - if (_fs2.default.statSyncNoException(ret) && (initScript.startsWith("/") || !_path2.default.resolve(_path2.default.dirname(ret), '..').match(/[\\\/]node_modules$/i))) { + if (fs.statSyncNoException(ret) && (initScript.startsWith("/") || !path.resolve(path.dirname(ret), '..').match(/[\\\/]node_modules$/i))) { return ret; }