-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
[local-cli][packager] Move packager initialization events to reporter #13209
Conversation
packager/src/lib/reporting.js
Outdated
const startedCallback = logReporter => { | ||
logReporter.update({ | ||
type: 'initialize_packager_started', | ||
port: args.port, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifier args
Could not resolve name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😓 oops
… log messages too
0ec23e3
to
21c5c60
Compare
Thanks for adding a lot of context! I pinged @davidaurelio and @jeanlauliac on work messenger. |
lgtm. I agree with the points you brought up, let’s address them with a follow-up (making |
@davidaurelio has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: This PR depends on #13172 Packager events are mostly logged through the TerminalReporter by default (#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook/react-native#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on facebook#13172 Packager events are mostly logged through the TerminalReporter by default (facebook#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on facebook#13172 Packager events are mostly logged through the TerminalReporter by default (facebook#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on facebook#13172 Packager events are mostly logged through the TerminalReporter by default (facebook#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on facebook#13172 Packager events are mostly logged through the TerminalReporter by default (facebook#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on facebook#13172 Packager events are mostly logged through the TerminalReporter by default (facebook#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on facebook#13172 Packager events are mostly logged through the TerminalReporter by default (facebook#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
Summary: This PR depends on #13172 Packager events are mostly logged through the TerminalReporter by default (#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter. - We [log a banner with some information about the port and what's going on](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L22-L32) - Also [a message about looking for JS files](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L34-L38) (not sure what that is for / if it is useful beyond telling the user what directory root they started the packager in, but that's another thing). - If the packager fails to start, then [we log an error message](https://github.com/facebook/react-native/blob/8c7b32d5f1da34613628b4b8e0474bc1e185a618/local-cli/server/server.js#L41-L61). This pull request changes those log messages to be handled by TerminalReporter. I tri Closes facebook/react-native#13209 Differential Revision: D4809759 Pulled By: davidaurelio fbshipit-source-id: 2c427ec0c1accaf54bf6b2d1da882cd6bfaa7829
This PR depends on #13172
Motivation
Packager events are mostly logged through the TerminalReporter by default (#13172 makes this configurable). But there are a few things that aren't passed through TerminalReporter.
This pull request changes those log messages to be handled by TerminalReporter. I tried to pick good names for the events based on existing names as defined in reporting.
Test Plan
Pull this, run
npm start
in root and open up UIExplorer. Works as expected, but somehow it just feels better, right?Next Steps
formatBanner
fromlocal-cli
inpackager/src/lib/TerminalReporter
, given that packager may split off at some point. I would have just moved it into the packager, but it's a dependency of checkNodeVersion.packagerServer
to get the reporter (here). Maybe we should expose a getter for it, or alogEvent
function on the packager server instance?