From 67bf731bcdde343cc6443034da62976b0f1f5bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96z=C3=BCm=20Eldo=C4=9Fan?= Date: Fri, 31 Mar 2023 11:53:21 +0300 Subject: [PATCH 1/4] Add sub-package info to environment-variables.mdx Add info about accessing root level `.env` file from sub-packages. --- .../docs/handbook/environment-variables.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/pages/repo/docs/handbook/environment-variables.mdx b/docs/pages/repo/docs/handbook/environment-variables.mdx index f49ab06196951..c1042ea396636 100644 --- a/docs/pages/repo/docs/handbook/environment-variables.mdx +++ b/docs/pages/repo/docs/handbook/environment-variables.mdx @@ -28,6 +28,23 @@ We're actively looking forward to improving the developer experience and ergonom } ``` +## Accessing root .env from sub-packages + +1. Place all of your variables into the root of your monorepo as a `.env` file. + +2. Install `dotenv-cli` into a sub-packge. + +```json +{ + "scripts": { ++. "dev": "dotenv -e ../../.env start-server" + } + "devDependencies": { ++ "dotenv-cli": "latest" + }, +} +``` + ## With global `turbo` If you're using `turbo` globally, you'll also need to install `dotenv-cli` globally so you can put `dotenv --` in front of the `turbo` command in your terminal. From 0d500b9fad0197a3078e15951e2665fc3d7affe1 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Mon, 3 Apr 2023 11:24:03 -0700 Subject: [PATCH 2/4] Reworking for clarity. --- .../repo/docs/handbook/environment-variables.mdx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/pages/repo/docs/handbook/environment-variables.mdx b/docs/pages/repo/docs/handbook/environment-variables.mdx index c1042ea396636..d18086820a970 100644 --- a/docs/pages/repo/docs/handbook/environment-variables.mdx +++ b/docs/pages/repo/docs/handbook/environment-variables.mdx @@ -28,11 +28,19 @@ We're actively looking forward to improving the developer experience and ergonom } ``` -## Accessing root .env from sub-packages +## With global `turbo` + +If you're using `turbo` globally, you'll also need to install `dotenv-cli` globally so you can put `dotenv --` in front of the `turbo` command in your terminal. + +## With workspace scripts + +You may prefer to make your workspaces responsible for owning their environment variables. This approach allows you greater flexibility if you don't mind the extra configuration overhead in your `package.json` scripts. + +To use this strategy: 1. Place all of your variables into the root of your monorepo as a `.env` file. -2. Install `dotenv-cli` into a sub-packge. +2. Install `dotenv-cli` in the workspace. ```json { @@ -44,7 +52,3 @@ We're actively looking forward to improving the developer experience and ergonom }, } ``` - -## With global `turbo` - -If you're using `turbo` globally, you'll also need to install `dotenv-cli` globally so you can put `dotenv --` in front of the `turbo` command in your terminal. From 6bc1fd43a802c6d9c84dcb174dacf7988b181b54 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Mon, 3 Apr 2023 12:47:44 -0700 Subject: [PATCH 3/4] Update docs/pages/repo/docs/handbook/environment-variables.mdx --- docs/pages/repo/docs/handbook/environment-variables.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/repo/docs/handbook/environment-variables.mdx b/docs/pages/repo/docs/handbook/environment-variables.mdx index d18086820a970..004776b13a4c4 100644 --- a/docs/pages/repo/docs/handbook/environment-variables.mdx +++ b/docs/pages/repo/docs/handbook/environment-variables.mdx @@ -34,7 +34,7 @@ If you're using `turbo` globally, you'll also need to install `dotenv-cli` globa ## With workspace scripts -You may prefer to make your workspaces responsible for owning their environment variables. This approach allows you greater flexibility if you don't mind the extra configuration overhead in your `package.json` scripts. +You may prefer to make your workspaces responsible for owning their environment variables. This approach is more flexible, if you don't mind the extra configuration overhead in your `package.json` scripts. To use this strategy: From 509686181de8344b2e39c810b071b01ef3679dfc Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Mon, 3 Apr 2023 12:48:16 -0700 Subject: [PATCH 4/4] Update docs/pages/repo/docs/handbook/environment-variables.mdx --- docs/pages/repo/docs/handbook/environment-variables.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/repo/docs/handbook/environment-variables.mdx b/docs/pages/repo/docs/handbook/environment-variables.mdx index 004776b13a4c4..6bb3d539f7f37 100644 --- a/docs/pages/repo/docs/handbook/environment-variables.mdx +++ b/docs/pages/repo/docs/handbook/environment-variables.mdx @@ -34,7 +34,7 @@ If you're using `turbo` globally, you'll also need to install `dotenv-cli` globa ## With workspace scripts -You may prefer to make your workspaces responsible for owning their environment variables. This approach is more flexible, if you don't mind the extra configuration overhead in your `package.json` scripts. +You may prefer to make your workspaces responsible for loading environment variables. This approach is more flexible, if you don't mind the extra configuration overhead in your `package.json` scripts. To use this strategy: