Skip to content

Commit

Permalink
chore(@turbo/types): remove deprecated fields (#8531)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-olszewski committed Jun 18, 2024
1 parent 7e76f0e commit 4710617
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
23 changes: 20 additions & 3 deletions packages/turbo-codemod/src/transforms/stabilize-env-mode.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -13,7 +17,20 @@ const DESCRIPTION =
"Rewrite experimentalPassThroughEnv and experimentalGlobalPassThroughEnv";
const INTRODUCED_IN = "1.10.0";

function migrateRootConfig(config: RootSchemaV1) {
type ExperimentalRootSchema = Omit<RootSchemaV1, "pipeline"> & {
experimentalGlobalPassThroughEnv?: null | Array<string>;
pipeline: Record<string, ExperimentalPipeline>;
};

type ExperimentalPipeline = Pipeline & {
experimentalPassThroughEnv?: null | Array<string>;
};

type ExperimentalSchema = Omit<SchemaV1, "pipeline"> & {
pipeline: Record<string, ExperimentalPipeline>;
};

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.
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 0 additions & 23 deletions packages/turbo-types/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,6 @@ export interface RootSchema extends BaseSchema {
*/
globalEnv?: Array<EnvWildcard>;

/**
* 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<string>;

/**
* 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`.
Expand Down Expand Up @@ -177,18 +166,6 @@ export interface Pipeline {
*/
env?: Array<EnvWildcard>;

/**
* 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<string>;

/**
* 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,
Expand Down

0 comments on commit 4710617

Please sign in to comment.