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

gatsby-cli: Consider exposing Reporter For Use By Starters and Plugins #3145

Closed
Undistraction opened this issue Dec 6, 2017 · 3 comments · May be fixed by danielres/gatsby#1
Closed

gatsby-cli: Consider exposing Reporter For Use By Starters and Plugins #3145

Undistraction opened this issue Dec 6, 2017 · 3 comments · May be fixed by danielres/gatsby#1

Comments

@Undistraction
Copy link
Contributor

Undistraction commented Dec 6, 2017

Using the reporter is a nice way to keep logging consistent, but it isn't exposed by gatsby-cli. I think it is worth exposing it or moving it to a separate consumable package.

It can be used by reaching in to lib: const reporter = require('gatsby-cli/lib/reporter'); which is fragile.

@jquense
Copy link
Contributor

jquense commented Dec 6, 2017

the reporter is exposed to plugins via the plugin api (https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/utils/api-runner-node.js#L76) I think this is probably safer than everyone requiring a singleton package. especially if we want to tweak or change how this is handled (or make them pluggable)

@Undistraction
Copy link
Contributor Author

Undistraction commented Dec 6, 2017

That's great. I'd missed that and it's definitely useful for plugins, however, it would be nice to have access to it in gatsby-nodeand any related code, for example to report on the creation of pages, tags etc.

I'm working on a starter that has a simple user-facing config that exposes some of the plugin options in a way that's easy to tweak (and allows the user-facing config to be validated). This means I build gatsby-config on the fly depending on what the user has enabled. Again, it would be great to have access to the reporter here.

It just seems silly to have to use a separate logger in these instances which I think are equally valid uses.

Another use would be in functional helpers, like the one that handles pagination.

@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

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 a pull request may close this issue.

4 participants