From 56ebca3cf9a06bc88b505a85339739edc671c4fa Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Wed, 31 Jul 2024 22:43:00 -0600 Subject: [PATCH 1/5] feat(tui): Set TURBO_IS_TUI environment variable when using TUI. --- crates/turborepo-lib/src/task_graph/visitor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/turborepo-lib/src/task_graph/visitor.rs b/crates/turborepo-lib/src/task_graph/visitor.rs index 27f301ca42c3b..3af701e111b62 100644 --- a/crates/turborepo-lib/src/task_graph/visitor.rs +++ b/crates/turborepo-lib/src/task_graph/visitor.rs @@ -914,6 +914,11 @@ impl ExecContext { cmd.env("TURBO_HASH", &self.task_hash); // enable task access tracing + // Allow downstream tools to detect if the task is being ran with TUI + if self.experimental_ui { + cmd.env("TURBO_IS_TUI", "true"); + } + // set the trace file env var - frameworks that support this can use it to // write out a trace file that we will use to automatically cache the task if self.task_access.is_enabled() { From 7e6d483b80354a7452afec76b4ba6fa2fc40d346 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Wed, 31 Jul 2024 22:49:07 -0600 Subject: [PATCH 2/5] Fix comment order. --- crates/turborepo-lib/src/task_graph/visitor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/turborepo-lib/src/task_graph/visitor.rs b/crates/turborepo-lib/src/task_graph/visitor.rs index 3af701e111b62..e34f35548c277 100644 --- a/crates/turborepo-lib/src/task_graph/visitor.rs +++ b/crates/turborepo-lib/src/task_graph/visitor.rs @@ -912,13 +912,14 @@ impl ExecContext { cmd.envs(self.execution_env.iter()); // Always last to make sure it overwrites any user configured env var. cmd.env("TURBO_HASH", &self.task_hash); - // enable task access tracing // Allow downstream tools to detect if the task is being ran with TUI if self.experimental_ui { cmd.env("TURBO_IS_TUI", "true"); } + // enable task access tracing + // set the trace file env var - frameworks that support this can use it to // write out a trace file that we will use to automatically cache the task if self.task_access.is_enabled() { From af1a3a277ae2e3eac5a1f207277205369611964f Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Wed, 31 Jul 2024 22:56:22 -0600 Subject: [PATCH 3/5] Document it. --- docs/repo-docs/reference/system-environment-variables.mdx | 7 ++++--- grep | 0 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 grep diff --git a/docs/repo-docs/reference/system-environment-variables.mdx b/docs/repo-docs/reference/system-environment-variables.mdx index 2ebb267f09ba7..255a6ad45f25b 100644 --- a/docs/repo-docs/reference/system-environment-variables.mdx +++ b/docs/repo-docs/reference/system-environment-variables.mdx @@ -39,6 +39,7 @@ System environment variables are always overridden by flag values provided direc Turborepo will make the following environment variables available within your tasks while they are executing: -| Variable | Description | -| ------------ | --------------------------------------- | -| `TURBO_HASH` | The hash of the currently running task. | +| Variable | Description | +| -------------- | -------------------------------------------------------------------------------------------- | +| `TURBO_HASH` | The hash of the currently running task. | +| `TURBO_IS_TUI` | When using the [TUI](/repo/docs/reference/configuration#ui), this variable is set to `true`. | diff --git a/grep b/grep new file mode 100644 index 0000000000000..e69de29bb2d1d From 9d4cdf6bb3b8e36d517c137512bfaf6bce406ea0 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Thu, 1 Aug 2024 07:46:26 -0600 Subject: [PATCH 4/5] chore: Remove accidental file. --- grep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 grep diff --git a/grep b/grep deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 0bcf8abd458011440161706bdcd04a7124a40125 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Thu, 1 Aug 2024 07:48:05 -0600 Subject: [PATCH 5/5] Remove. --- grep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 grep diff --git a/grep b/grep deleted file mode 100644 index e69de29bb2d1d..0000000000000