From fe670171bc5a91946395c8642a04c4808b78c5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Thu, 1 Mar 2018 10:17:04 -0300 Subject: [PATCH] Allow calling bin/hatch-previewer from other directories Now non-flatpak standalone requires bin/hatch-previewer to be run from the root of the repository. Change path to the module to be the module path, not the current directory, in the case where we are not in a flatpak package and not imported as a module. Otherwise if `PATH/TO/bin/hatch-previewer ` is called from an ingester dir, the `index.js` of the ingester is executed! --- bin/hatch-previewer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/hatch-previewer b/bin/hatch-previewer index ac3ae65..a77c6c4 100755 --- a/bin/hatch-previewer +++ b/bin/hatch-previewer @@ -16,11 +16,11 @@ const allArgs = process.argv; const passedArgs = allArgs.slice(2); // Try to load us as a module if we're imported, otherwise if /app/main exists, -// assume we're running in a flatpak package. Lastly, run from the current +// assume we're running in a flatpak package. Lastly, run from the parent // directory. let pathToHatchPreviewerModule = '/app/main'; if (!fs.existsSync(pathToHatchPreviewerModule)) - pathToHatchPreviewerModule = path.resolve('.'); + pathToHatchPreviewerModule = path.resolve(__dirname, '..'); try { pathToHatchPreviewerModule = path.dirname(require.resolve('hatch-previewer')); } catch (e) {