Skip to content

Commit b42d824

Browse files
committed
WIP 37a72
1 parent 7155266 commit b42d824

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

packages/turbo-utils/src/getTurboConfigs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
PipelineV2,
1212
} from "@turbo/types";
1313
import * as logger from "./logger";
14-
import { getTurboRoot } from "./getTurboRoot";
14+
import { getTurboRoot, clearTurboRootCache } from "./getTurboRoot";
1515
import type { PackageJson, PNPMWorkspaceConfig } from "./types";
1616

1717
const ROOT_GLOB = "{turbo.json,turbo.jsonc}";
@@ -302,4 +302,5 @@ export function clearConfigCaches(): void {
302302
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- This is safe.
303303
delete workspaceConfigCache[key];
304304
});
305+
clearTurboRootCache();
305306
}

packages/turbo-utils/src/getTurboRoot.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ function contentCheck(content: string): boolean {
1414

1515
const configCache: Record<string, string> = {};
1616

17+
export function clearTurboRootCache(): void {
18+
Object.keys(configCache).forEach((key) => {
19+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- This is safe.
20+
delete configCache[key];
21+
});
22+
}
23+
1724
export function getTurboRoot(cwd?: string, opts?: Options): string | null {
1825
const cacheEnabled = opts?.cache ?? true;
1926
const currentDir = cwd || process.cwd();

packages/turbo-utils/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// utils
2-
export { getTurboRoot } from "./getTurboRoot";
2+
export { getTurboRoot, clearTurboRootCache } from "./getTurboRoot";
33
export {
44
getTurboConfigs,
55
getWorkspaceConfigs,

0 commit comments

Comments
 (0)