Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: steps seem to run independent from each other #705

Open
1 task done
timcreatedit opened this issue Apr 23, 2024 · 6 comments
Open
1 task done

fix: steps seem to run independent from each other #705

timcreatedit opened this issue Apr 23, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@timcreatedit
Copy link

Is there an existing issue for this?

  • 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

  1. Define a script with multiple steps such as:
fail:
    steps:
      - cd packages/
      - pwd
  1. 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

@spydon
Copy link
Collaborator

spydon commented Apr 23, 2024

What do you think @jessicatarra, would it make sense running all the steps in the same context?

@timcreatedit
Copy link
Author

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?

@spydon
Copy link
Collaborator

spydon commented Apr 23, 2024

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.

@timcreatedit
Copy link
Author

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?

@spydon
Copy link
Collaborator

spydon commented Apr 23, 2024

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.

@spydon
Copy link
Collaborator

spydon commented Jun 5, 2024

This issue will be solved by #711

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants