Skip to content

Commit

Permalink
Merge pull request #99 from ChristopherBiscardi/debug
Browse files Browse the repository at this point in the history
Enable DEBUG=gatsby:* gatsby develop

Conflicts:
	lib/utils/develop.js
	lib/utils/post-build.js
  • Loading branch information
KyleAMathews committed Dec 20, 2015
2 parents 2b0fffa + f978f74 commit b666e08
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/utils/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import fs from 'fs'
import getUserGatsbyConfig from './get-user-gatsby-config'
import globPages from './glob-pages'
import webpackConfig from './webpack.config'
const debug = require('debug')('gatsby:application')

module.exports = (program) => {
const directory = program.directory
Expand All @@ -30,8 +31,10 @@ module.exports = (program) => {

let HTMLPath
if (fs.existsSync(directory + '/html.cjsx') || fs.existsSync(directory + '/html.jsx')) {
debug('using project\'s html wrapper')
HTMLPath = directory + '/html'
} else {
debug('using gatsby default html wrapper')
HTMLPath = __dirname + '/../isomorphic/html'
}

Expand All @@ -47,6 +50,7 @@ module.exports = (program) => {
process.exit()
}
const HTML = factory()
debug('configuring server')

const webpackDevServer = new WebpackDevServer(compiler, {
hot: true,
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/glob-pages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fs = require 'fs'
frontMatter = require 'front-matter'
_ = require 'underscore'
toml = require('toml')
debug = require('debug')('gatsby:glob')

module.exports = (directory, callback) ->
# Read in site config.
Expand Down Expand Up @@ -73,4 +74,5 @@ module.exports = (directory, callback) ->

pagesData.push pageData

debug('globbed', pagesData.length, 'pages');
callback(null, pagesData)
2 changes: 2 additions & 0 deletions lib/utils/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import fs from 'fs-extra'
import async from 'async'
import parsePath from 'parse-filepath'
import _ from 'underscore'
const debug = require('debug')('gatsby:post-build')

import globPages from './glob-pages'

module.exports = (program, cb) => {
const directory = program.directory

return globPages(directory, (err, pages) => {
debug('copying files')
// Async callback to copy each file.
const copy = function copyFile (file, callback) {
// Map file to path generated for that directory.
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/static-generation.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ webpack = require 'webpack'
globPages = require './glob-pages'
webpackConfig = require './webpack.config'
getUserGatsbyConfig = require './get-user-gatsby-config'
debug = require('debug')('gatsby:static')

module.exports = (program, callback) ->
{relativeDirectory, directory} = program

globPages directory, (err, pages) ->
debug('generating static site')
routes = pages.filter((page) -> page.path?).map((page) -> page.path)

#### Static site generation.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"coffee-script": "^1.9.3",
"commander": "^2.8.1",
"css-loader": "^0.22.0",
"debug": "^2.2.0",
"front-matter": "^1.0.0",
"fs-extra": "^0.19.0",
"glob": "^5.0.7",
Expand Down Expand Up @@ -73,7 +74,7 @@
},
"scripts": {
"test": "npm run lint",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern build ."
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern dist ."
},
"devDependencies": {
"babel": "^5.8.34",
Expand Down

0 comments on commit b666e08

Please sign in to comment.