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

fix(gatsby-cli): build successfully without optional dependencies #14383

Merged
merged 2 commits into from
May 29, 2019

Conversation

ryandrew14
Copy link
Contributor

Description

This PR solves the issue raised in #14370, where trying to build the site after installing without optional dependencies will fail due to ink not being installed. The change uses the straightforward solution proposed by @wardpeet of ensuring the module exists before using it, and defaulting to yurna in the case that it does not exist.

Related Issues

Fixes #14370

@ryandrew14 ryandrew14 requested a review from a team as a code owner May 29, 2019 00:08
if (semver.satisfies(process.version, `>=8`) && !isCI) {
let inkExists = false
try {
inkExists = require.resolve(`ink`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just wondering -- why do I see backticks used everywhere for normal strings inside requires? I followed this convention here, but I don't understand why we do it.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is just convention we use here. It's much nicer to work with template literals - in case we need to use interpolation we don't have to convert from "normal strings" to template literal

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @ryandrew14!

@pieh pieh merged commit e5db077 into gatsbyjs:master May 29, 2019
@pieh
Copy link
Contributor

pieh commented May 29, 2019

gatsby-cli@2.6.3 and gatsby@2.7.5 were published

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.

installing gatsby with --no-optional breaks gatsby-cli
2 participants