From 4fe152c2de247792f792d1c596b09f8c8d9ee0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steve=20Beaug=C3=A9?= <184604+stevebeauge@users.noreply.github.com> Date: Wed, 27 Mar 2024 09:32:42 +0100 Subject: [PATCH] Fix init-env.ts to expand {workspaceRoot} token --- lib/init-env.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/init-env.ts b/lib/init-env.ts index 2109f11..777ffd3 100644 --- a/lib/init-env.ts +++ b/lib/init-env.ts @@ -1,11 +1,15 @@ import dotenv from "dotenv"; +import { workspaceRoot } from "nx/src/utils/workspace-root"; import { CustomRunnerOptions } from "./types/custom-runner-options"; - /** * Initializes the environment variables. */ export const initEnv = (options: CustomRunnerOptions) => { if (options.dotenv !== false) { - dotenv.config({ path: options.dotenvPath }); + const dotenvConfig = { + path: options.dotenvPath?.replace("{workspaceRoot}", workspaceRoot), + }; + console.log("🍕 dotenv config", dotenvConfig); + dotenv.config(dotenvConfig); } };