From 8399050d364d33cd862f58cf7fc13c6f3345439a Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Mon, 30 Jan 2023 02:43:12 -0800 Subject: [PATCH] fix(publishing-bumped-packages): look for status code instaead of stderr (#36004) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36004 Changelog: [Internal] This fixes CircleCI job, which is responsible for publishing bumped packages. We should not check for `stderr`, apparently `npm` uses it to store debug information: - https://github.com/npm/npm/issues/118#issuecomment-325440 So we've tried to use this on 0.71-stable before and it succesfully published one package, but have exited right after it because `stderr` was not empty Reviewed By: cipolleschi Differential Revision: D42836212 fbshipit-source-id: a09cb7adc750cbb9e735bdefbe92050f9f5767c6 --- scripts/monorepo/find-and-publish-all-bumped-packages.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/monorepo/find-and-publish-all-bumped-packages.js b/scripts/monorepo/find-and-publish-all-bumped-packages.js index 17e06596c3af2b..f700f5c9c9889d 100644 --- a/scripts/monorepo/find-and-publish-all-bumped-packages.js +++ b/scripts/monorepo/find-and-publish-all-bumped-packages.js @@ -103,15 +103,15 @@ const findAndPublishAllBumpedPackages = () => { const npmOTPFlag = NPM_CONFIG_OTP ? `--otp ${NPM_CONFIG_OTP}` : ''; - const {stderr} = spawnSync('npm', ['publish', `${npmOTPFlag}`], { + const {status, stderr} = spawnSync('npm', ['publish', `${npmOTPFlag}`], { cwd: packageAbsolutePath, shell: true, stdio: 'pipe', encoding: 'utf-8', }); - if (stderr) { + if (status !== 0) { console.log( - `\u274c Failed to publish version ${nextVersion} of ${packageManifest.name}:`, + `\u274c Failed to publish version ${nextVersion} of ${packageManifest.name}. npm publish exited with code ${status}:`, ); console.log(stderr);