Skip to content

Commit

Permalink
fix: get gatsby-dev-cli working with tilde/home shortcut (#8337)
Browse files Browse the repository at this point in the history
  • Loading branch information
DSchau committed Sep 19, 2018
1 parent 38e570c commit ae51353
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/gatsby-dev-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Configstore = require(`configstore`)
const pkg = require(`../package.json`)
const _ = require(`lodash`)
const path = require(`path`)
const os = require(`os`)
const watch = require(`./watch`)

const argv = require(`yargs`)
Expand Down Expand Up @@ -40,9 +41,12 @@ if (!havePackageJsonFile) {
process.exit()
}

const pathToRepo = argv.setPathToRepo
let pathToRepo = argv.setPathToRepo

if (pathToRepo) {
console.log(`Saving path to your Gatsby repo`)
if (pathToRepo.includes(`~`)) {
pathToRepo = path.join(os.homedir(), pathToRepo.split(`~`).pop())
}
conf.set(`gatsby-location`, path.resolve(pathToRepo))
process.exit()
}
Expand Down

0 comments on commit ae51353

Please sign in to comment.