Closed emmalynch closed 4 years ago
Hey! That's not how Yarn works, actually. The exact order isn't set, except that it's a consistent one (by that I mean that it should be consistent across systems, but that alphabetical sort is perfectly fine).
If you're looking to execute a script in your workspaces in topological order (ie by taking their inter-relationships into account), then I think you want to use the --topological
flag in yarn workspaces foreach
. Does that make sense?
I've just noticed that you mention "build scripts", which may be interpreted as "postinstall scripts". In that case, make sure you properly list the dependencies between your workspaces (ie that the workspace containing the tests depends on the core package), as this is how Yarn will be able to sort the workspaces for coherent builds.
Aah, that makes sense. I think I just presumed the default behaviour was the same as using the --topological
flag, since that's how it appeared to work when I was building locally. That did the trick though!
I'm still unsure why a build would succeed on one system but not another though, with or without that flag if the order should be consistent across systems. I'll have another read of the docs for my own info anyway. Thanks for the help!
Describe the bug
On Windows, workspaces are not built in the order they're specified. It appears to use alphabetical order. This creates problems when workspaces depend on others with names that are alphabetically after their own.
To Reproduce
I haven't added a Sherlock repro, as it wouldn't run against Windows and the issue doesn't happen on Linux.
package.json: https://github.com/emmalynch/cookie-cutter/blob/feature/yarn2/package.json
azure
has a dependency oncore
travis build: https://travis-ci.org/github/walmartlabs/cookie-cutter/builds/686522850 Running
yarn build && yarn test
on Windows gives the following error:Environment if relevant (please complete the following information):
OS: Windows (Windows Server, version 1809)
$ node --version v10.20.1
$ npm --version 6.14.4
$ nvs --version 1.5.4
$ yarn --version 2.0.0-rc.33
Additional context
This issue is occurring on a travis build. The same project builds successfully on both MacOS and Linux.