[rush] `rush list --json` outputs non-JSON output when a lockfile is created or deleted
Summary
If you create or delete your lockfile and run rush list --json, the following is output to stdout:
Lockfile was created or deleted. Assuming all projects are affected.
{
"projects": [
...
]
}
This breaks automation that attempts to pipe the result of rush list --json to a tool like jq since the first line is not JSON.
Repro steps
- Delete a lockfile
- Commit
- Re-add the lockfile
- Run
rush list --json --impacted-by git:$COMMIT_SHA_WHERE_LOCKFILE_DOES_NOT_EXIST
Expected result: Only JSON is output to stdout. Since the error is a useful one, perhaps it should be output to stderr to preserve the ability to pipe the JSON to jq?
Actual result: The message "Lockfile was created or deleted. Assuming all projects are affected." is printed to stdout before the JSON is printed.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@microsoft/rush globally installed version? |
5.153.2 |
rushVersion from rush.json? |
5.153.2 |
useWorkspaces from rush.json? |
No |
| Operating system? | Linux |
| Would you consider contributing a PR? | Yes |
Node.js version (node -v)? |
22.18.0 |
Probably pretty simple to fix. Are you interested in putting together a PR?