From aa9526fe73df046a2b276740017bcfc3199ca487 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 25 Aug 2023 11:22:54 -0400 Subject: [PATCH] fix(core): handle empty lines in dotenv files (#18829) --- .../update-16-8-0/escape-dollar-sign-env-variables.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nx/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.ts b/packages/nx/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.ts index de32897c0eb42..a335cdb10fb89 100644 --- a/packages/nx/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.ts +++ b/packages/nx/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.ts @@ -64,6 +64,11 @@ function parseEnvFile(tree: Tree, envFilePath: string) { .split('\n') .map((line) => { line = line.trim(); + + if (!line.includes('$')) { + return line; + } + const declarations = line.split('='); if (declarations[1].includes('$') && !declarations[1].includes(`\\$`)) { declarations[1] = declarations[1].replace('$', `\\$`);