diff --git a/packages/turbo-codemod/src/transforms/stabilize-env-mode.ts b/packages/turbo-codemod/src/transforms/stabilize-env-mode.ts index d47a70ffee52b..74e078e3ab710 100644 --- a/packages/turbo-codemod/src/transforms/stabilize-env-mode.ts +++ b/packages/turbo-codemod/src/transforms/stabilize-env-mode.ts @@ -1,7 +1,11 @@ import path from "node:path"; import { readJsonSync, existsSync } from "fs-extra"; import { type PackageJson, getTurboConfigs } from "@turbo/utils"; -import type { SchemaV1, RootSchemaV1 } from "@turbo/types/src/types/config"; +import type { + SchemaV1, + RootSchemaV1, + Pipeline, +} from "@turbo/types/src/types/config"; import type { Transformer, TransformerArgs } from "../types"; import { getTransformerHelpers } from "../utils/getTransformerHelpers"; import type { TransformerResults } from "../runner"; @@ -13,7 +17,20 @@ const DESCRIPTION = "Rewrite experimentalPassThroughEnv and experimentalGlobalPassThroughEnv"; const INTRODUCED_IN = "1.10.0"; -function migrateRootConfig(config: RootSchemaV1) { +type ExperimentalRootSchema = Omit & { + experimentalGlobalPassThroughEnv?: null | Array; + pipeline: Record; +}; + +type ExperimentalPipeline = Pipeline & { + experimentalPassThroughEnv?: null | Array; +}; + +type ExperimentalSchema = Omit & { + pipeline: Record; +}; + +function migrateRootConfig(config: ExperimentalRootSchema) { const oldConfig = config.experimentalGlobalPassThroughEnv; const newConfig = config.globalPassThroughEnv; // Set to an empty array is meaningful, so we have undefined as an option here. @@ -45,7 +62,7 @@ function migrateRootConfig(config: RootSchemaV1) { return migrateTaskConfigs(config); } -function migrateTaskConfigs(config: SchemaV1) { +function migrateTaskConfigs(config: ExperimentalSchema) { for (const [_, taskDef] of Object.entries(config.pipeline)) { const oldConfig = taskDef.experimentalPassThroughEnv; const newConfig = taskDef.passThroughEnv; diff --git a/packages/turbo-types/src/types/config.ts b/packages/turbo-types/src/types/config.ts index 255353eb06135..3c8aa1a553414 100644 --- a/packages/turbo-types/src/types/config.ts +++ b/packages/turbo-types/src/types/config.ts @@ -90,17 +90,6 @@ export interface RootSchema extends BaseSchema { */ globalEnv?: Array; - /** - * An allowlist of environment variables that should be made to all tasks, but - * should not contribute to the task's cache key, e.g. `AWS_SECRET_KEY`. - * - * Documentation: https://turbo.build/repo/docs/reference/configuration#globalpassthroughenv - * - * @defaultValue null - * @deprecated use `globalPassThroughEnv` instead - */ - experimentalGlobalPassThroughEnv?: null | Array; - /** * An allowlist of environment variables that should be made to all tasks, but * should not contribute to the task's cache key, e.g. `AWS_SECRET_KEY`. @@ -177,18 +166,6 @@ export interface Pipeline { */ env?: Array; - /** - * An allowlist of environment variables that should be made available in this - * task's environment, but should not contribute to the task's cache key, - * e.g. `AWS_SECRET_KEY`. - * - * Documentation: https://turbo.build/repo/docs/reference/configuration#passthroughenv - * - * @defaultValue null - * @deprecated use `passThroughEnv` instead - */ - experimentalPassThroughEnv?: null | Array; - /** * An allowlist of environment variables that should be made available in this * task's environment, but should not contribute to the task's cache key,