-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
[bug] Commands joined with &&
don't run locally installed binaries
#1061
Comments
Side question: Having to use run: |
git fetch origin
git branch -f main origin/main That ends up being translated to |
Yeah, this most likely will not be supported. Tasks were designed to only be 1 command, not multiple, because this entirely breaks the integrated toolchain. The exception to this is system commands, where running multiple/pipes/redirects work fine, just so long as you don't use language specific commands. The proper way to do this is with 2 tasks: clean:
command: rm -rf dist
platform: system
compile:
command: tsc --version
platform: node
deps: [clean] |
I get that we could use deps for that, but it seems so unnecessary on the surface. Not trying to bully you into agreeing, just tossing that out there. Hoping maybe there's a use case that's compelling enough for a slight change in the future :) |
It's either use the toolchain and single commands, or ignore the toolchain and do whatever you want. There's no in between from the context of moon. You could ignore the toolchain and use proto directly, but that'll only work for languages, and not packages (tsc, etc). For example, say we had a command like
Another piece not mentioned, is that multiple commands does not work with inheritance, especially when merging in additional arguments, or overriding the binary name. |
OK all of that makes sense. I think we broached a tangential topic a while back as well, because some of this reasoning looks familiar. Would it be worth adding a summary like above to the docs? |
Updated docs, will close. |
Describe the bug
Commands that are joined with
&&
don't appear to look for or run locally installed binaries.Steps to reproduce
Create a command:
Install
typescript
locally into a project, make sure it's not installed globally.Run the command. Should result in
tsc not found
Remove the leading
rm -rf dist &&
and rerun the command, should output something likeVersion 5.2.2
and succeed.Expected behavior
This bit me hard today because I had TypeScript v5.0.4 installed globally, while 5.2.2 was installed locally. There is a strict mode build difference between the two versions, and I was not encountering an error while a collaborator was. We couldn't figure out what the difference was. Finally dawned on me to add
tsc --version
to the command and noticed the difference in version numbers.Once I removed the global dependency, moon starting throwing
tsc not found
.I was expecting Moon to always look to the local dependencies first, and then look to the global deps. That's been the default behavior of npm/yarn/pnpm for some time.
Screenshots
Environment
Additional context
The text was updated successfully, but these errors were encountered: