Skip to content

Commit ce02306

Browse files
authored
[rush] Route lockfile-changed warning to stderr (#5804)
`rush list --json` writes `Lockfile was created or deleted. Assuming all projects are affected.` to stdout when the lockfile was added or removed in the diff range, which corrupts the JSON output and breaks pipes such as `rush list --json --impacted-by git:<sha> | jq .`. The information is useful diagnostic context, so rather than suppress it, route it through `terminal.writeWarningLine` (which writes to stderr) -- the standard CLI convention for warnings that should not pollute machine-readable stdout. Matches how the rest of this file already emits non-fatal diagnostics (see lines 418, 446, 458). Fixes #5406
1 parent 83bdc16 commit ce02306

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Route the \"Lockfile was created or deleted\" warning to stderr so that machine-readable output (e.g. `rush list --json`) remains parseable when the lockfile was added or removed in the diff range.",
5+
"type": "patch",
6+
"packageName": "@microsoft/rush"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "sshaurya914@gmail.com"
11+
}

libraries/rush-lib/src/logic/ProjectChangeAnalyzer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ export class ProjectChangeAnalyzer {
220220
if (shrinkwrapStatus) {
221221
if (shrinkwrapStatus.status !== 'M') {
222222
if (rushConfiguration.subspacesFeatureEnabled) {
223-
terminal.writeLine(
223+
terminal.writeWarningLine(
224224
`"${subspace.subspaceName}" subspace lockfile was created or deleted. Assuming all projects are affected.`
225225
);
226226
} else {
227-
terminal.writeLine(`Lockfile was created or deleted. Assuming all projects are affected.`);
227+
terminal.writeWarningLine(
228+
`Lockfile was created or deleted. Assuming all projects are affected.`
229+
);
228230
}
229231
for (const project of subspaceProjects) {
230232
changedProjects.add(project);

0 commit comments

Comments
 (0)