You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wireit uses the yarn run -TB wireit command to access its own binary from any part of the workspace. It pulls the package.json from your current directory and runs the specified script.
In prior versions of yarn (e.g. 3.2.1), this worked. In 4.0.1, every script is run as if the current directory is the workspace root.
# failure in 4.0.1> mkdir -p test/packages/inner
>echo'{"workspaces":["packages/*"],"scripts":{"test-direct":"echo \"hi from yarn@root\"","test-wireit":"yarn run -TB wireit"},"wireit":{"test-wireit":{"command":"echo \"hi from wireit@root\""}},"devDependencies":{"wireit": "0.7.1"}}'> test/package.json
>echo'{"workspaces":["packages/*"],"scripts":{"test-direct":"echo \"hi from yarn@inner\"","test-wireit":"yarn run -TB wireit"},"wireit":{"test-wireit":{"command":"echo \"hi from wireit@inner\""}}}'> test/packages/inner/package.json
>cdtest> yarn set version 4.0.1
> yarn
>cd packages/inner/
> yarn run test-direct
hi from yarn@inner
> yarn run test-wireit
🏃 [test-wireit] Running command"echo "hi from wireit@root"" ❌❌ this should be @inner
hi from wireit@root
✅ [test-wireit] Executed successfully
# success in 3.2.1> mkdir -p test/packages/inner
>echo'{"workspaces":["packages/*"],"scripts":{"test-direct":"echo \"hi from yarn@root\"","test-wireit":"yarn run -TB wireit"},"wireit":{"test-wireit":{"command":"echo \"hi from wireit@root\""}},"devDependencies":{"wireit": "0.7.1"}}'> test/package.json
>echo'{"workspaces":["packages/*"],"scripts":{"test-direct":"echo \"hi from yarn@inner\"","test-wireit":"yarn run -TB wireit"},"wireit":{"test-wireit":{"command":"echo \"hi from wireit@inner\""}}}'> test/packages/inner/package.json
>cdtest> curl -o ./yarn-3.2.1.js https://raw.githubusercontent.com/material-foundation/trapeze/71eb1dd3da3ad00eacb90d6087eb5f13a396b575/third_party/.yarn/releases/yarn-3.2.1.cjs
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2121k 100 2121k 0 0 3000k 0 --:--:-- --:--:-- --:--:-- 3018k
>echo -e "nodeLinker: node-modules \nyarnPath: "$PWD"/yarn-3.2.1.js"> .yarnrc.yml
> yarn
➤ YN0000: ┌ Resolution step
➤ YN0032: │ fsevents@npm:2.3.3: Implicit dependencies on node-gyp are discouraged
➤ YN0000: └ Completed in 2s 60ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ which@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry➤ YN0013: │ wireit@npm:0.7.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrap-ansi@npm:7.0.0 can't be found in the cache and will be fetched from the remote registry➤ YN0013: │ wrap-ansi@npm:8.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry➤ YN0000: └ Completed➤ YN0000: ┌ Link step➤ YN0000: └ Completed in 0s 243ms➤ YN0000: Done with warnings in 2s 428ms> cd packages/inner/> yarn run test-directhi from yarn@inner> yarn run test-wireit🏃 [test-wireit] Running command "echo "hi from wireit@inner""hi from wireit@inner✅ [test-wireit] Executed successfully
Note: yarn use version 3.2.1 was setting 4.0.1, so I'm manually curling the old version.
Actually no, it's something different unrelated to Yarn 4. If you update your example to use 3.2.2, you'll see the same thing. I'm not sure what changed that, but it's been there for a good chunk of time already (3.2.2 was released Jul 21, 2022). I'll investigate a little to better understand whether it's expected or not.
Self-service
Describe the bug
wireit uses the
yarn run -TB wireit
command to access its own binary from any part of the workspace. It pulls thepackage.json
from your current directory and runs the specified script.In prior versions of yarn (e.g. 3.2.1), this worked. In 4.0.1, every script is run as if the current directory is the workspace root.
cc @aomarks
To reproduce
Note:
yarn use version 3.2.1
was setting 4.0.1, so I'm manuallycurl
ing the old version.Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: