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 dev round #2 #762

Merged
merged 4 commits into from
Mar 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions packages/gatsby-dev-cli/bin/gatsby-dev
Original file line number Diff line number Diff line change
@@ -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);