Skip to content

Commit

Permalink
fix(release): parse NPM output for JSON to prevent JSON.parse from th…
Browse files Browse the repository at this point in the history
…rowing

closed nrwl#22925
  • Loading branch information
gutentag2012 committed May 1, 2024
1 parent abd80cf commit 9669f61
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ export default async function runExecutor(
stdio: ['ignore', 'pipe', 'pipe'],
});

const resultJson = JSON.parse(result.toString());
const jsonRegex = /\{(?:[^{}])*\}/g;
const jsonObjectsInOutput = result.toString().match(jsonRegex);
const resultJson = JSON.parse(
jsonObjectsInOutput[jsonObjectsInOutput.length - 1]
);

const distTags = resultJson['dist-tags'] || {};
if (distTags[tag] === currentVersion) {
console.warn(
Expand Down

0 comments on commit 9669f61

Please sign in to comment.