Skip to content

build(server-api): upgrade pretty-format to 29.7.0 #2656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mateoguzmana
Copy link

@mateoguzmana mateoguzmana commented Apr 30, 2025

Summary

Motivation: The React Native core repository throws some warnings when installing fresh dependencies as it has some incompatible resolutions for react-is. Digging deeper into it, I noticed pretty-format@^26.6.2 (which comes from this repo) has react-is "^17.0.1" as a dependency, and this causes one of the warnings.

Saw this as an opportunity to bump this and get rid of one of them.

See:

pretty-format@^26.6.2:
  version "26.6.2"
  resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93"
  integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==
  dependencies:
    "@jest/types" "^26.6.2"
    ansi-regex "^5.0.0"
    ansi-styles "^4.0.0"
    react-is "^17.0.1" <-- here

Test Plan

CI should be green, and I also did a sanity check that nothing breaks in the serializeMessage function by linking the CLI to a newly created react native project and then running yarn react-native info

Code snippet (can be added at the bottom of packages/cli-server-api/src/websocket/createEventsSocketEndpoint.ts):
// Mock a generic Metro event
const mockEvent = {
  type: 'report',
  error: new Error('Something went wrong'),
  timestamp: Date.now(),
};

console.log('Serialized generic error event:\n', serializeMessage(mockEvent));

// Mock a client_log with non-string arguments
const mockClientLogEvent = {
  type: 'client_log',
  data: [
    'User clicked button',
    {user: 'testUser', action: 'click', details: {buttonId: 42}},
    [1, 2, {nested: 'object'}],
  ],
};

console.log(
  'Serialized client_log event:\n',
  serializeMessage(mockClientLogEvent),
);

// Mock a normal message with no special formatting
const mockPlainEvent = {
  type: 'info',
  message: 'Everything is fine',
};

console.log('Serialid plain message:\n', serializeMessage(mockPlainEvent));

Output:

(base) user/textinputreproducer (main) % yarn react-native info
yarn run v1.22.22
$ /Users/user/Documents/textinputreproducer/node_modules/.bin/react-native info
Serialized generic error event:
 {"type":"report","error":"[Error: Something went wrong]","timestamp":1746041941646}
Serialized client_log event:
 {"type":"client_log","data":["User clicked button","{\"action\": \"click\", \"details\": {\"buttonId\": 42}, \"user\": \"testUser\"}","[1, 2, {\"nested\": \"object\"}]"]}
Serialized plain message:
 {"type":"info","message":"Everything is fine"}
info Fetching melo system and libraries information...

Checklist

  • Documentation is up to date.
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

@mateoguzmana mateoguzmana marked this pull request as ready for review April 30, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant