From 5a135a2cf33e57cc33439b6eedad443e6537c28b Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 16 Jul 2021 10:05:52 +0200 Subject: [PATCH] fix(cli-repl): use try-require instead of if-else for buildInfo Fix for an issue I only noticed moments after merging: We should always try to look for the build info JSON file, because that is not just present in compiled builds, but also in npm packages. --- packages/cli-repl/src/run.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli-repl/src/run.ts b/packages/cli-repl/src/run.ts index 4d22a79b44..b3fc2048e3 100644 --- a/packages/cli-repl/src/run.ts +++ b/packages/cli-repl/src/run.ts @@ -27,12 +27,12 @@ import os from 'os'; // eslint-disable-next-line no-console console.log(version); } else if (options.buildInfo) { - if (process.execPath === process.argv[1]) { + try { const buildInfo = require('./build-info.json'); delete buildInfo.segmentApiKey; // eslint-disable-next-line no-console console.log(JSON.stringify(buildInfo, null, ' ')); - } else { + } catch { // eslint-disable-next-line no-console console.log(JSON.stringify({ version,