From ea6ae9e21caabe579e588b20d4d2eb0da544f522 Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Mon, 21 Oct 2024 09:52:19 -0500 Subject: [PATCH] Fix .env parsing --- bin-src/register.js | 18 ++++++------------ package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/bin-src/register.js b/bin-src/register.js index ae9010b3b..6fa671851 100755 --- a/bin-src/register.js +++ b/bin-src/register.js @@ -1,19 +1,13 @@ #!/usr/bin/env node -import { config } from 'dotenv'; - -import { main as initMain } from './init'; -import { main } from './main'; -import { main as traceMain } from './trace'; -import { main as trimMain } from './trimStatsFile'; - -config(); +import 'dotenv/config'; const commands = { - init: () => initMain(process.argv.slice(3)), - main: () => main(process.argv.slice(2)), - trace: () => traceMain(process.argv.slice(3)), - 'trim-stats-file': () => trimMain(process.argv.slice(3)), + init: () => import('./init').then(({ main: initMain }) => initMain(process.argv.slice(3))), + main: () => import('./main').then(({ main }) => main(process.argv.slice(2))), + trace: () => import('./trace').then(({ main: traceMain }) => traceMain(process.argv.slice(3))), + 'trim-stats-file': () => + import('./trimStatsFile').then(({ main: trimMain }) => trimMain(process.argv.slice(3))), }; (commands[process.argv[2]] || commands.main)(); diff --git a/package.json b/package.json index 6502bd870..9a2ab4420 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "cross-env": "^7.0.3", "cross-spawn": "^7.0.2", "debug": "^4.3.2", - "dotenv": "^8.2.0", + "dotenv": "^16.4.5", "env-ci": "^11.1.0", "eslint": "^9.10.0", "eslint-config-prettier": "^9.0.0", diff --git a/yarn.lock b/yarn.lock index 509f0de6b..c71c8c607 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7564,7 +7564,7 @@ __metadata: cross-env: "npm:^7.0.3" cross-spawn: "npm:^7.0.2" debug: "npm:^4.3.2" - dotenv: "npm:^8.2.0" + dotenv: "npm:^16.4.5" env-ci: "npm:^11.1.0" eslint: "npm:^9.10.0" eslint-config-prettier: "npm:^9.0.0" @@ -8796,14 +8796,14 @@ __metadata: languageName: node linkType: hard -"dotenv@npm:^16.0.0": +"dotenv@npm:^16.0.0, dotenv@npm:^16.4.5": version: 16.4.5 resolution: "dotenv@npm:16.4.5" checksum: 10c0/48d92870076832af0418b13acd6e5a5a3e83bb00df690d9812e94b24aff62b88ade955ac99a05501305b8dc8f1b0ee7638b18493deb6fe93d680e5220936292f languageName: node linkType: hard -"dotenv@npm:^8.0.0, dotenv@npm:^8.2.0": +"dotenv@npm:^8.0.0": version: 8.6.0 resolution: "dotenv@npm:8.6.0" checksum: 10c0/6750431dea8efbd54b9f2d9681b04e1ccc7989486461dcf058bb708d9e3d63b04115fcdf8840e38ad1e24a4a2e1e7c1560626c5e3ac7bc09371b127c49e2d45f