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

Question: Is Gatsby a devDependency or dependency? #832

Closed
NMinhNguyen opened this issue Apr 20, 2017 · 4 comments
Closed

Question: Is Gatsby a devDependency or dependency? #832

NMinhNguyen opened this issue Apr 20, 2017 · 4 comments

Comments

@NMinhNguyen
Copy link
Contributor

I have looked at some of the starters, and they all seem to specify Gatsby under dependencies in package.json: gatsby-starter-default, gatsby-starter-kitchen-sink, gatsby-starter-documentation

Is there a reason it's not under devDependencies instead?

@KyleAMathews
Copy link
Contributor

A Gatsby site without Gatsby can't do anything so it's a dependency.

A devDependency is for packages that are published to NPM so you need to differentiate between packages needed by "consumers" of a package vs. "producers". Since anyone using a Gatsby repo is a producer, everything goes in dependencies.

@michaek
Copy link
Contributor

michaek commented Aug 3, 2017

@KyleAMathews I think that's good as a general rule, but it seems like it may be overly restrictive. For instance, a library with documentation generated by Gatsby might want to have gatsby as a devDependency. Would you be opposed to something like require('gatsby') in the try/catch, rather than looking at the dependencies in package.json? https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-cli/src/index.js#L14

@KyleAMathews
Copy link
Contributor

@michaek good point. Yeah there are definitely cases where devDependencies makes more sense.

require('gatsby') wouldn't work as that's relative to the CLI. The resolveCwd could work but node resolution is such that it looks up the hierarchy for modules until it finds something. Which is perhaps what we want (you could run gatsby develop in a sub-directory of a site and it'd work) but it would be a change of behavior.

@KyleAMathews
Copy link
Contributor

If nothing else, checking for gatsby in devDependencies in gatsby-cli should definitely happen.

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

No branches or pull requests

3 participants