melos
melos copied to clipboard
fix: `steps` seem to run independent from each other
Is there an existing issue for this?
- [X] I have searched the existing issues.
Version
5.3.0
Description
When defining a script with multiple steps, the working directory from the previous step doesn't seem to be maintained for the next step. This means steps
is not a working fix for #470 as far as I understand.
Steps to reproduce
- Define a script with multiple steps such as:
fail:
steps:
- cd packages/
- pwd
- Run the script
melos run fail
Expected behavior
The script should print {workspace_root}/packages
, but the second step happens in the workspace root again.
Screenshots
No response
Additional context and comments
No response
What do you think @jessicatarra, would it make sense running all the steps in the same context?
I would understand if you keep it like this (also because it's more consistent with GitHub workflows), but then I feel like we would need to be clear about that in the docs and reopen #470?
I would understand if you keep it like this (also because it's more consistent with GitHub workflows), but then I feel like we would need to be clear about that in the docs and reopen #470?
I don't think 470 is exactly about this use-case so it's better to use a new issue for that.
I don't think 470 is exactly about this use-case so it's better to use a new issue for that.
While it's not specifically about this, it was closed with the reason that steps
provides a fix for it. This suggests that
run: |
command1
command2
(which didn't work on windows) is equivalent to the new
steps:
- command1
- command2
But it isn't, as long the steps are executed in different contexts. So I think the issue should remain open, since there is still no way to get a multi command script to work on windows without resorting to &
, or am I missing something?
So I think the issue should remain open, since there is still no way to get a multi command script to work on windows without resorting to &, or am I missing something?
I think that is how it is intended to be (it's kind of just abusing a yaml feature to support multiple lines), Melos doesn't transform the result into a shell script with multiple lines.
This issue will be solved by https://github.com/invertase/melos/pull/711