Skip to content

Commit

Permalink
Fix gatsby dev round #2 (#762)
Browse files Browse the repository at this point in the history
* Add missing dependency configstore

* Add note about needing to set path to cloned repo

* Fix gatsby-dev logic
  • Loading branch information
KyleAMathews committed Mar 28, 2017
1 parent 82ff66a commit 80e93d6
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions packages/gatsby-dev-cli/bin/gatsby-dev
@@ -1,36 +1,42 @@
#!/usr/bin/env node

const Configstore = require('configstore');
const pkg = require('../package.json');
var argv = require('yargs').array('packages').argv;
const Configstore = require("configstore");
const pkg = require("../package.json");
var argv = require("yargs").array("packages").argv;

const conf = new Configstore(pkg.name);

const gatsbyLocation = conf.get('gatsby-location');
if (argv.setPathToRepo) {
console.log("Saving path to your Gatsby repo");
conf.set("gatsby-location", argv.setPathToRepo);
process.exit();
}

const gatsbyLocation = conf.get("gatsby-location");

if (!gatsbyLocation) {
console.log(`
console.log(
`
You haven't set the path yet to your cloned
version of Gatsby. Do so now by running:
gatsby-dev --set-path-to-repo /path/to/my/cloned/version/gatsby
`)
process.exit()
}

if (argv.setPathToRepo) {
console.log('setting path to repo')
conf.set('gatsby-location', argv.setPathToRepo)
`
);
process.exit();
}

if (!argv.packages) {
console.log(`
console.log(
`
You probably want to pass in a list of packages to start
developing on! For example:
gatsby-dev --packages gatsby gatsby-typegen-remark
`)
`
);
process.exit();
}

const watch = require('../')
watch(gatsbyLocation, argv.packages)
const watch = require("../");
watch(gatsbyLocation, argv.packages);

0 comments on commit 80e93d6

Please sign in to comment.