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: cortinico, cipolleschi

Differential Revision: D42836212

fbshipit-source-id: 6f2a9a512121683268fe6aae6a187fccb8d9dfbc
This commit is contained in:
Ruslan Lesiutin
2023-01-30 16:02:37 +00:00
committed by Lorenzo Sciandra
parent 76ca8e2dc9
commit 77936fa640
@@ -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);