From 11fb2f3e64279283516cf5b85651c45941ab72ea Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 10 May 2024 13:21:44 -0600 Subject: [PATCH 1/5] Move fs cache location. --- crates/turborepo-cache/src/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/turborepo-cache/src/fs.rs b/crates/turborepo-cache/src/fs.rs index 629d337241451..a8a205ec5d783 100644 --- a/crates/turborepo-cache/src/fs.rs +++ b/crates/turborepo-cache/src/fs.rs @@ -37,7 +37,7 @@ impl FSCache { if let Some(override_dir) = override_dir { AbsoluteSystemPathBuf::from_unknown(repo_root, override_dir) } else { - repo_root.join_components(&["node_modules", ".cache", "turbo"]) + repo_root.join_components(&[".turbo", "cache"]) } } From 30fe2db6d6577e34c79a093b21a25a821651b5e6 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 10 May 2024 13:42:24 -0600 Subject: [PATCH 2/5] Fix tests. --- crates/turborepo-cache/src/async_cache.rs | 24 ++++++----------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/crates/turborepo-cache/src/async_cache.rs b/crates/turborepo-cache/src/async_cache.rs index 94c32a0ad8da6..89116829c8105 100644 --- a/crates/turborepo-cache/src/async_cache.rs +++ b/crates/turborepo-cache/src/async_cache.rs @@ -272,12 +272,8 @@ mod tests { // Wait for async cache to process async_cache.wait().await.unwrap(); - let fs_cache_path = repo_root_path.join_components(&[ - "node_modules", - ".cache", - "turbo", - &format!("{}.tar.zst", hash), - ]); + let fs_cache_path = + repo_root_path.join_components(&[".turbo", "cache", &format!("{}.tar.zst", hash)]); // Confirm that fs cache file does *not* exist assert!(!fs_cache_path.exists()); @@ -360,12 +356,8 @@ mod tests { // Wait for async cache to process async_cache.wait().await.unwrap(); - let fs_cache_path = repo_root_path.join_components(&[ - "node_modules", - ".cache", - "turbo", - &format!("{}.tar.zst", hash), - ]); + let fs_cache_path = + repo_root_path.join_components(&[".turbo", "cache", &format!("{}.tar.zst", hash)]); // Confirm that fs cache file exists assert!(fs_cache_path.exists()); @@ -454,12 +446,8 @@ mod tests { // Wait for async cache to process async_cache.wait().await.unwrap(); - let fs_cache_path = repo_root_path.join_components(&[ - "node_modules", - ".cache", - "turbo", - &format!("{}.tar.zst", hash), - ]); + let fs_cache_path = + repo_root_path.join_components(&[".turbo", "cache" & format!("{}.tar.zst", hash)]); // Confirm that fs cache file exists assert!(fs_cache_path.exists()); From f23d251720ccdbc1b84026f15f592de222653877 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 10 May 2024 13:59:01 -0600 Subject: [PATCH 3/5] Update crates/turborepo-cache/src/async_cache.rs Co-authored-by: Chris Olszewski --- crates/turborepo-cache/src/async_cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/turborepo-cache/src/async_cache.rs b/crates/turborepo-cache/src/async_cache.rs index 89116829c8105..c8961b173ec0b 100644 --- a/crates/turborepo-cache/src/async_cache.rs +++ b/crates/turborepo-cache/src/async_cache.rs @@ -447,7 +447,7 @@ mod tests { async_cache.wait().await.unwrap(); let fs_cache_path = - repo_root_path.join_components(&[".turbo", "cache" & format!("{}.tar.zst", hash)]); + repo_root_path.join_components(&[".turbo", "cache", &format!("{}.tar.zst", hash)]); // Confirm that fs cache file exists assert!(fs_cache_path.exists()); From 61360fca38bc8c3b26676fa9b840decf7733bcc5 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 10 May 2024 22:12:52 -0600 Subject: [PATCH 4/5] Update integration tests. --- .../integration/tests/run-caching/cache-state.t | 2 +- .../integration/tests/workspace-configs/add-keys.t | 2 +- .../integration/tests/workspace-configs/cache.t | 8 ++++---- .../tests/workspace-configs/missing-workspace-config.t | 4 ++-- .../integration/tests/workspace-configs/omit-keys-deps.t | 2 +- .../integration/tests/workspace-configs/omit-keys.t | 2 +- .../integration/tests/workspace-configs/override-values.t | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/turborepo-tests/integration/tests/run-caching/cache-state.t b/turborepo-tests/integration/tests/run-caching/cache-state.t index 6c441317fa974..f2580768185ba 100644 --- a/turborepo-tests/integration/tests/run-caching/cache-state.t +++ b/turborepo-tests/integration/tests/run-caching/cache-state.t @@ -17,7 +17,7 @@ Do a dry run so we can see the state of the cache Get the hash of the my-app#build task, so we can inspect the cache $ HASH=$(cat dry.json | jq -r '.tasks | map(select(.taskId == "my-app#build")) | .[0].hash') - $ duration=$(cat "node_modules/.cache/turbo/$HASH-meta.json" | jq .duration) + $ duration=$(cat "node_modules/.turbo/cache/$HASH-meta.json" | jq .duration) check that it exists $ echo $duration [0-9]+ (re) diff --git a/turborepo-tests/integration/tests/workspace-configs/add-keys.t b/turborepo-tests/integration/tests/workspace-configs/add-keys.t index 2781e27a04dc5..a7ac4495913e0 100644 --- a/turborepo-tests/integration/tests/workspace-configs/add-keys.t +++ b/turborepo-tests/integration/tests/workspace-configs/add-keys.t @@ -31,7 +31,7 @@ Setup Time:\s*[\.0-9]+m?s (re) $ HASH=$(cat tmp.log | grep -E "add-keys:add-keys-task.* executing .*" | awk '{print $5}') - $ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst; apps/add-keys/.turbo/turbo-add-keys-task.log apps/add-keys/out/ apps/add-keys/out/.keep diff --git a/turborepo-tests/integration/tests/workspace-configs/cache.t b/turborepo-tests/integration/tests/workspace-configs/cache.t index 22076afe2135f..7ab4e97b976e9 100644 --- a/turborepo-tests/integration/tests/workspace-configs/cache.t +++ b/turborepo-tests/integration/tests/workspace-configs/cache.t @@ -26,7 +26,7 @@ This test covers: $ HASH=$(cat tmp.log | grep -E "cached:cached-task-1.* executing .*" | awk '{print $5}') $ echo $HASH [a-z0-9]{16} (re) - $ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst; apps/cached/.turbo/turbo-cached-task-1.log apps/cached/out/ apps/cached/out/.keep @@ -51,7 +51,7 @@ This test covers: $ HASH=$(cat tmp.log | grep -E "cached:cached-task-2.* executing .*" | awk '{print $6}') $ echo $HASH [a-z0-9]{16} (re) - $ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ test -f $TARGET_DIR/.cache/turbo/$HASH.tar.zst; [1] no `cache` config in root, cache:false in workspace @@ -73,7 +73,7 @@ no `cache` config in root, cache:false in workspace $ HASH=$(cat tmp.log | grep -E "cached:cached-task-3.* executing .*" | awk '{print $6}') $ echo $HASH [a-z0-9]{16} (re) - $ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst; [1] cache:false in root, no turbo.json in workspace. @@ -97,5 +97,5 @@ we already have a workspace that doesn't have a config $ HASH=$(cat tmp.log | grep -E "missing-workspace-config:cached-task-4.* executing .*" | awk '{print $6}') $ echo $HASH [a-z0-9]{16} (re) - $ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst; [1] diff --git a/turborepo-tests/integration/tests/workspace-configs/missing-workspace-config.t b/turborepo-tests/integration/tests/workspace-configs/missing-workspace-config.t index c4cbae18966ac..b5ae828184324 100644 --- a/turborepo-tests/integration/tests/workspace-configs/missing-workspace-config.t +++ b/turborepo-tests/integration/tests/workspace-configs/missing-workspace-config.t @@ -22,7 +22,7 @@ Setup Time:\s*[\.0-9]+m?s (re) $ HASH=$(cat tmp.log | grep -E "missing-workspace-config:missing-workspace-config-task.* executing .*" | awk '{print $5}') - $ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst; apps/missing-workspace-config/.turbo/turbo-missing-workspace-config-task.log apps/missing-workspace-config/out/ apps/missing-workspace-config/out/.keep @@ -102,5 +102,5 @@ Setup $ HASH=$(cat tmp.log | grep -E "missing-workspace-config:cached-task-4.* executing .*" | awk '{print $6}') $ echo $HASH [a-z0-9]{16} (re) - $ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst; [1] diff --git a/turborepo-tests/integration/tests/workspace-configs/omit-keys-deps.t b/turborepo-tests/integration/tests/workspace-configs/omit-keys-deps.t index c229c3bc5a125..d44e5307fa1c0 100644 --- a/turborepo-tests/integration/tests/workspace-configs/omit-keys-deps.t +++ b/turborepo-tests/integration/tests/workspace-configs/omit-keys-deps.t @@ -43,7 +43,7 @@ Setup Time:\s*[\.0-9]+m?s (re) $ HASH=$(cat tmp.log | grep -E "omit-keys:omit-keys-task-with-deps.* executing .*" | awk '{print $5}') - $ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst; apps/omit-keys/.turbo/turbo-omit-keys-task-with-deps.log apps/omit-keys/out/ apps/omit-keys/out/.keep diff --git a/turborepo-tests/integration/tests/workspace-configs/omit-keys.t b/turborepo-tests/integration/tests/workspace-configs/omit-keys.t index 939676a78a083..d5d50a159713a 100644 --- a/turborepo-tests/integration/tests/workspace-configs/omit-keys.t +++ b/turborepo-tests/integration/tests/workspace-configs/omit-keys.t @@ -25,7 +25,7 @@ Setup Time:\s*[\.0-9]+m?s (re) $ HASH=$(cat tmp.log | grep -E "omit-keys:omit-keys-task.* executing .*" | awk '{print $5}') - $ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst; apps/omit-keys/.turbo/turbo-omit-keys-task.log apps/omit-keys/out/ apps/omit-keys/out/.keep diff --git a/turborepo-tests/integration/tests/workspace-configs/override-values.t b/turborepo-tests/integration/tests/workspace-configs/override-values.t index 3388bb7ed1e30..f244e0475a958 100644 --- a/turborepo-tests/integration/tests/workspace-configs/override-values.t +++ b/turborepo-tests/integration/tests/workspace-configs/override-values.t @@ -22,7 +22,7 @@ Setup Time:\s*[\.0-9]+m?s (re) $ HASH=$(cat tmp.log | grep -E "override-values:override-values-task.* executing .*" | awk '{print $5}') - $ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst; + $ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst; apps/override-values/.turbo/turbo-override-values-task.log apps/override-values/lib/ apps/override-values/lib/.keep From c998da469470e9b8db4ae7d4a4642cf954799453 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Fri, 10 May 2024 22:15:48 -0600 Subject: [PATCH 5/5] Fix typos. --- turborepo-tests/integration/tests/run-caching/cache-state.t | 2 +- turborepo-tests/integration/tests/workspace-configs/cache.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/turborepo-tests/integration/tests/run-caching/cache-state.t b/turborepo-tests/integration/tests/run-caching/cache-state.t index f2580768185ba..fbe40396cdcdd 100644 --- a/turborepo-tests/integration/tests/run-caching/cache-state.t +++ b/turborepo-tests/integration/tests/run-caching/cache-state.t @@ -17,7 +17,7 @@ Do a dry run so we can see the state of the cache Get the hash of the my-app#build task, so we can inspect the cache $ HASH=$(cat dry.json | jq -r '.tasks | map(select(.taskId == "my-app#build")) | .[0].hash') - $ duration=$(cat "node_modules/.turbo/cache/$HASH-meta.json" | jq .duration) + $ duration=$(cat ".turbo/cache/$HASH-meta.json" | jq .duration) check that it exists $ echo $duration [0-9]+ (re) diff --git a/turborepo-tests/integration/tests/workspace-configs/cache.t b/turborepo-tests/integration/tests/workspace-configs/cache.t index 7ab4e97b976e9..4fdc1a837d28f 100644 --- a/turborepo-tests/integration/tests/workspace-configs/cache.t +++ b/turborepo-tests/integration/tests/workspace-configs/cache.t @@ -51,7 +51,7 @@ This test covers: $ HASH=$(cat tmp.log | grep -E "cached:cached-task-2.* executing .*" | awk '{print $6}') $ echo $HASH [a-z0-9]{16} (re) - $ test -f $TARGET_DIR/.cache/turbo/$HASH.tar.zst; + $ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst; [1] no `cache` config in root, cache:false in workspace