From 2a024fc6ba3ab935d468a7a33f5f3b5b2de8f1b3 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Wed, 18 Oct 2023 11:29:34 +0200 Subject: [PATCH 1/3] chore: Added new lines to improve code readability (formatting change) --- packages/ember-cli-mirage/config/environment.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/ember-cli-mirage/config/environment.js b/packages/ember-cli-mirage/config/environment.js index 35e9cd98e..af0b262f6 100644 --- a/packages/ember-cli-mirage/config/environment.js +++ b/packages/ember-cli-mirage/config/environment.js @@ -1,4 +1,5 @@ 'use strict'; + const fs = require('fs'); function usingProxy() { @@ -12,6 +13,7 @@ function usingProxy() { let hasGeneratedProxies = false; const proxiesDir = `${process.env.PWD}/server/proxies`; + try { fs.lstatSync(proxiesDir); hasGeneratedProxies = true; From a0e7a44aebe9cb07317699fbe17f19d1e227fc04 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Wed, 18 Oct 2023 11:29:56 +0200 Subject: [PATCH 2/3] bugfix: Used the join() method to join folder paths, independently of the operating system --- packages/ember-cli-mirage/config/environment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ember-cli-mirage/config/environment.js b/packages/ember-cli-mirage/config/environment.js index af0b262f6..f1e0614f2 100644 --- a/packages/ember-cli-mirage/config/environment.js +++ b/packages/ember-cli-mirage/config/environment.js @@ -1,6 +1,7 @@ 'use strict'; const fs = require('fs'); +const path = require('path'); function usingProxy() { const usingProxyArg = !!process.argv.filter(function (arg) { @@ -12,7 +13,7 @@ function usingProxy() { }).length; let hasGeneratedProxies = false; - const proxiesDir = `${process.env.PWD}/server/proxies`; + const proxiesDir = path.join(process.env.PWD, 'server', 'proxies'); try { fs.lstatSync(proxiesDir); From 7a04eb01b43a3d59397dd68c912ead335ab91f20 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Wed, 18 Oct 2023 11:50:32 +0200 Subject: [PATCH 3/3] bugfix: Replaced process.env.PWD with process.cwd(), to get the working directory independently of the operating system --- packages/ember-cli-mirage/config/environment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ember-cli-mirage/config/environment.js b/packages/ember-cli-mirage/config/environment.js index f1e0614f2..642e1ecab 100644 --- a/packages/ember-cli-mirage/config/environment.js +++ b/packages/ember-cli-mirage/config/environment.js @@ -13,7 +13,7 @@ function usingProxy() { }).length; let hasGeneratedProxies = false; - const proxiesDir = path.join(process.env.PWD, 'server', 'proxies'); + const proxiesDir = path.join(process.cwd(), 'server', 'proxies'); try { fs.lstatSync(proxiesDir);