manuallyHashPackages should output Unix paths
What version of Turborepo are you using?
#951
What operating system are you using?
Windows
Describe the Bug
In #951 we introduced manuallyHashPackages which uses system separators, while the call to GetPackageDeps always uses Unix separators.
https://github.com/vercel/turborepo/pull/951/files#diff-1f9866465d609e250b0b23f8e9c5b085873e0de4e2fd26a04f9f4c6b28b833b0R70-R80
You can compare the output of the two here:
map[eslint-preset.js:cedc38df2ccfc76a6bad3096e750f824d081688f package.json:8e96aa4af87706362ee55108d7525092ea1f84b4]
map[eslint-preset.js:cedc38df2ccfc76a6bad3096e750f824d081688f package.json:8e96aa4af87706362ee55108d7525092ea1f84b4]
map[.gitignore:1437c53f70bc211ec65739ec4a8c2a4db5874c73 README.md:1d67ece731bd0f0b84399107932958c28050cbd2 next-env.d.ts:4f11a03dc6cc37f2b5105c08f2e7b24c603ab2f4 next.config.js:53e0a424874077a8328b3ca90468878ffe5077aa package.json:4d0c2a4eb5f3040822900a9a6ad8292c8cc7f9e9 pages/index.tsx:0d1dabc123c517f54c07359c93cafa7adb1e4b8b tsconfig.json:a355365ba6525f861183a7a2f480ca1b4f0a2156]
map[.gitignore:1437c53f70bc211ec65739ec4a8c2a4db5874c73 README.md:1d67ece731bd0f0b84399107932958c28050cbd2 next-env.d.ts:4f11a03dc6cc37f2b5105c08f2e7b24c603ab2f4 next.config.js:53e0a424874077a8328b3ca90468878ffe5077aa package.json:4d0c2a4eb5f3040822900a9a6ad8292c8cc7f9e9 pages\index.tsx:0d1dabc123c517f54c07359c93cafa7adb1e4b8b tsconfig.json:a355365ba6525f861183a7a2f480ca1b4f0a2156]
map[base.json:d72a9f3a27835434aadbb1d173136c7384375630 nextjs.json:91cd404f775d62e567d5a8d3700657ffaab4cd09 package.json:d49a4c6ee807edc7ebf8488d9cf585338f60ce3b react-library.json:6d6a7fea97f1027b50176ad3276ed3b2d1d61687]
map[base.json:d72a9f3a27835434aadbb1d173136c7384375630 nextjs.json:91cd404f775d62e567d5a8d3700657ffaab4cd09 package.json:d49a4c6ee807edc7ebf8488d9cf585338f60ce3b react-library.json:6d6a7fea97f1027b50176ad3276ed3b2d1d61687]
map[Button.tsx:3e5afc737ab02f86823bf3ed1473782efcc12cbc index.tsx:916730e8fa531cefbf8435583bd6d68670717a66 package.json:10ca040dadd74e9a1877e705a305b141b82788ba tsconfig.json:cd6c94d6e8b0c3b34c21ef652ef4d56c64b4a5df]
map[Button.tsx:3e5afc737ab02f86823bf3ed1473782efcc12cbc index.tsx:916730e8fa531cefbf8435583bd6d68670717a66 package.json:10ca040dadd74e9a1877e705a305b141b82788ba tsconfig.json:cd6c94d6e8b0c3b34c21ef652ef4d56c64b4a5df]
map[.gitignore:1437c53f70bc211ec65739ec4a8c2a4db5874c73 README.md:1d67ece731bd0f0b84399107932958c28050cbd2 next-env.d.ts:4f11a03dc6cc37f2b5105c08f2e7b24c603ab2f4 next.config.js:53e0a424874077a8328b3ca90468878ffe5077aa package.json:a3694c197a907e3b2dbbf3fcbf60d73a6322c97a pages/index.tsx:6ec0887ce02b4b458193ce7ffb090b89afba7a95 tsconfig.json:a355365ba6525f861183a7a2f480ca1b4f0a2156]
map[.gitignore:1437c53f70bc211ec65739ec4a8c2a4db5874c73 README.md:1d67ece731bd0f0b84399107932958c28050cbd2 next-env.d.ts:4f11a03dc6cc37f2b5105c08f2e7b24c603ab2f4 next.config.js:53e0a424874077a8328b3ca90468878ffe5077aa package.json:a3694c197a907e3b2dbbf3fcbf60d73a6322c97a pages\index.tsx:6ec0887ce02b4b458193ce7ffb090b89afba7a95 tsconfig.json:a355365ba6525f861183a7a2f480ca1b4f0a2156]
Expected Behavior
For cache item keys the path should always be Unix paths in order to allow for cross-platform sharing.
The impact of this is likely low, it requires GetPackageDeps to fail prior to ending up in this code path.
To Reproduce
This can be confirmed by git checkout 1594d442 and applying this diff on a Windows box:
diff --git a/cli/internal/run/hash.go b/cli/internal/run/hash.go
index 4d78e5af..7654b698 100644
--- a/cli/internal/run/hash.go
+++ b/cli/internal/run/hash.go
@@ -67,16 +67,18 @@ func safeCompileIgnoreFile(filepath string) (*gitignore.GitIgnore, error) {
}
func (pfs *packageFileSpec) hash(pkg *fs.PackageJSON, rootPath string) (string, error) {
- hashObject, pkgDepsErr := fs.GetPackageDeps(&fs.PackageDepsOptions{
+ hashObject, _ := fs.GetPackageDeps(&fs.PackageDepsOptions{
PackagePath: pkg.Dir,
InputPatterns: pfs.inputs,
})
- if pkgDepsErr != nil {
+ fmt.Printf("%v", hashObject)
+ if true {
manualHashObject, err := manuallyHashPackage(pkg, pfs.inputs, rootPath)
if err != nil {
return "", err
}
hashObject = manualHashObject
+ fmt.Printf("%v", hashObject)
}
hashOfFiles, otherErr := fs.HashObject(hashObject)
if otherErr != nil {
@nathanhammond is this resolved now?
We've come a long, long way since these days so I'll close this one out!