From 1d2235cb625d1facd569ae1c04f5cdb2888b4c0f Mon Sep 17 00:00:00 2001 From: nodkz Date: Sun, 23 Jul 2017 21:23:18 +0600 Subject: [PATCH] fix(ApiParser): Better `elasticsearch` module path resolving. It does not work with global installed elasticsearch, eg in Docker container. Closes #6 --- src/ElasticApiParser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ElasticApiParser.js b/src/ElasticApiParser.js index 6ea45d6..bacb919 100644 --- a/src/ElasticApiParser.js +++ b/src/ElasticApiParser.js @@ -123,7 +123,8 @@ export default class ElasticApiParser { } static findApiVersionFile(version: string): string { - const apiFolder = './node_modules/elasticsearch/src/lib/apis/'; + const esModulePath = path.dirname(require.resolve('elasticsearch')); + const apiFolder = `${esModulePath}/lib/apis/`; const apiListFile = path.resolve(apiFolder, 'index.js'); const apiListCode = ElasticApiParser.loadApiListFile(apiListFile);