Skip to content

Commit

Permalink
fix(gatsby-dev-cli): move package.json file check after pathToRepo ha…
Browse files Browse the repository at this point in the history
…ndling (#11565)
  • Loading branch information
amad-person authored and pieh committed Feb 5, 2019
1 parent ec8deb2 commit da0cbab
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/gatsby-dev-cli/src/index.js
Expand Up @@ -36,12 +36,6 @@ You typically only need to configure this once.`
const conf = new Configstore(pkg.name)

const fs = require(`fs-extra`)
const havePackageJsonFile = fs.existsSync(`package.json`)

if (!havePackageJsonFile) {
console.error(`Current folder must have a package.json file!`)
process.exit()
}

let pathToRepo = argv.setPathToRepo

Expand All @@ -53,6 +47,13 @@ if (pathToRepo) {
process.exit()
}

const havePackageJsonFile = fs.existsSync(`package.json`)

if (!havePackageJsonFile) {
console.error(`Current folder must have a package.json file!`)
process.exit()
}

const gatsbyLocation = conf.get(`gatsby-location`)

if (!gatsbyLocation) {
Expand Down

0 comments on commit da0cbab

Please sign in to comment.