invertase / melos

🌋 A tool for managing Dart projects with multiple packages. With IntelliJ and Vscode IDE support. Supports automated versioning, changelogs & publishing via Conventional Commits.
https://melos.invertase.dev/~melos-latest
Apache License 2.0
1.19k stars 207 forks source link

`_` is replaced with path to `melos` in `melos exec` arguments #146

Closed blaugold closed 3 years ago

blaugold commented 3 years ago

Somehow, all underscores in the arguments to melos exec are replaced with the path to melos:

➜  cbl-dart git:(ci/android-tests) ✗ melos exec --scope cbl_flutter_example -- echo XXX _ XXX
$ melos exec
   └> echo XXX _ XXX
       └> RUNNING (in 1 packages)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
cbl_flutter_example:
XXX /home/gabriel/.pub-cache/bin/melos XXX
cbl_flutter_example: SUCCESS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

$ melos exec
   └> echo XXX _ XXX
       └> SUCCESS

This is with version 0.5.0-dev.2.

It does not happen though when activating melos for local development at the tip of master (7e585250994a89d56c9c9116b1606b0ce8166428):

➜  cbl-dart git:(ci/android-tests) ✗ melos exec --scope cbl_flutter_example -- echo XXX _ XXX
$ melos exec
   └> echo XXX _ XXX
       └> RUNNING (in 1 packages)

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
cbl_flutter_example:
echo XXX _ XXX
XXX _ XXX
cbl_flutter_example: SUCCESS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

$ melos exec
   └> echo XXX _ XXX
       └> SUCCESS

But I can't see how the changes between those commits could affect this issue (https://github.com/invertase/melos/compare/2756d758710ede14f0871cb8915bcc2eb51a51ca...7e585250994a89d56c9c9116b1606b0ce8166428).

Salakar commented 3 years ago

Sneaky regression, I see the issue though, easy fix;

https://github.com/invertase/melos/blob/master/packages/melos/lib/src/common/utils.dart#L247-L248

Those 2 lines need to be wrapped in an if (key.startsWith('MELOS_')) { ... } since only melos environment variables should be injected into the command. The _ env variable in your case is being injected

Salakar commented 3 years ago

Fixed in 1.0.0-dev.1 (no other changes from 0.5.0-dev.X - we're just graduating to stable versioning that's all)