Skip to content
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

Closed

Conversation

brentvatne
Copy link
Collaborator

@brentvatne brentvatne commented Mar 30, 2017

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

  • I'm not very happy about having to include formatBanner from local-cli in packager/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.
  • Not a huge fan of accessing a private-by-naming-convention property on packagerServer to get the reporter (here). Maybe we should expose a getter for it, or a logEvent function on the packager server instance?
  • Are there more events that we can send to the TerminalReporter? For example, we internally track the URL of a bundle request, it might be useful to send that along somewhere as well.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Mar 30, 2017
const startedCallback = logReporter => {
logReporter.update({
type: 'initialize_packager_started',
port: args.port,

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

Copy link
Collaborator Author

@brentvatne brentvatne Mar 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😓 oops

@brentvatne brentvatne force-pushed the more-packager-events-to-reporter branch from 0ec23e3 to 21c5c60 Compare March 30, 2017 15:41
@mkonicek
Copy link
Contributor

Thanks for adding a lot of context! I pinged @davidaurelio and @jeanlauliac on work messenger.

@davidaurelio
Copy link
Contributor

lgtm.

I agree with the points you brought up, let’s address them with a follow-up (making .reporter public, moving formatBanner to the packager directory)

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Mar 31, 2017
@facebook-github-bot
Copy link
Contributor

@davidaurelio has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Mar 31, 2017
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
ide pushed a commit to expo/react-native that referenced this pull request Apr 4, 2017
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
ide pushed a commit to expo/react-native that referenced this pull request Apr 5, 2017
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
ide pushed a commit to expo/react-native that referenced this pull request Apr 5, 2017
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
ide pushed a commit to expo/react-native that referenced this pull request Apr 7, 2017
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
brentvatne added a commit to expo/react-native that referenced this pull request Apr 20, 2017
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
thotegowda pushed a commit to thotegowda/react-native that referenced this pull request May 7, 2017
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
grabbou pushed a commit to react-native-community/cli that referenced this pull request Sep 26, 2018
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
@brentvatne brentvatne deleted the more-packager-events-to-reporter branch May 13, 2019 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants