Skip to content

Commit

Permalink
fix(scripts/monorepo): silent nx verbose messages when invoking getAf…
Browse files Browse the repository at this point in the history
…fectedPackages to emit valid JSON (#33103)
  • Loading branch information
Hotell authored Oct 23, 2024
1 parent b01032e commit e659bb6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scripts/monorepo/src/getAffectedPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ const { workspaceRoot } = require('./utils');
* @returns {Set<string>} - Set of packages that are affected by in the current branch
*/
function getAffectedPackages(base = 'origin/master') {
const res = spawnSync('nx', ['show', 'projects', '--affected', `--base=${base}`, '--json'], {
const cmdArgs = [
'show',
'projects',
'--affected',
`--base=${base}`,
'--json',
// override NX_VERBOSE_LOGGING in order to emit valid JSON
`--verbose=false`,
];
const res = spawnSync('nx', cmdArgs, {
cwd: workspaceRoot,
shell: true,
});

if (res.status !== 0) {
console.error(res.stderr);
throw new Error(`'nx show projects --affected --base ${base} --json' failed with status ${res.status}`);
throw new Error(`'nx ${cmdArgs.join(' ')}' failed with status ${res.status}`);
}

const output = res.stdout.toString();
Expand Down

0 comments on commit e659bb6

Please sign in to comment.