diff --git a/appveyor.yml b/appveyor.yml index dd02acdcab846..b4c4c56abd3ad 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,6 +57,7 @@ install: - choco install yarn --ignore-dependencies - refreshenv - echo we are running on %PLATFORM% + - node --version - yarn global add gatsby-dev-cli@canary - yarn run bootstrap - node --version diff --git a/lerna.json b/lerna.json index 571c2abeb46ee..9b8257dc040c2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.1.1", + "lerna": "2.4.0", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/gatsby-cli/.gitignore b/packages/gatsby-cli/.gitignore index 2132b55e6405e..506822a9de33d 100644 --- a/packages/gatsby-cli/.gitignore +++ b/packages/gatsby-cli/.gitignore @@ -1,2 +1,4 @@ +/lib /*.js +/reporter yarn.lock diff --git a/packages/gatsby-cli/package.json b/packages/gatsby-cli/package.json index 5b73baf072fca..4e27fac1c6e1f 100644 --- a/packages/gatsby-cli/package.json +++ b/packages/gatsby-cli/package.json @@ -4,17 +4,25 @@ "version": "1.1.9", "author": "Kyle Mathews ", "bin": { - "gatsby": "./index.js" + "gatsby": "lib/index.js" }, "dependencies": { + "babel-code-frame": "^6.26.0", "babel-runtime": "^6.26.0", - "commander": "^2.11.0", + "bluebird": "^3.5.0", + "common-tags": "^1.4.0", + "convert-hrtime": "^2.0.0", "core-js": "^2.5.0", + "execa": "^0.8.0", "fs-extra": "^4.0.1", "hosted-git-info": "^2.5.0", "lodash": "^4.17.4", + "pretty-error": "^2.1.1", "resolve-cwd": "^2.0.0", - "tracer": "^0.8.9" + "source-map": "^0.5.7", + "stack-trace": "^0.0.10", + "yargs": "^8.0.2", + "yurnalist": "^0.2.1" }, "devDependencies": { "babel-cli": "^6.26.0", @@ -24,10 +32,10 @@ "gatsby" ], "license": "MIT", - "main": "index.js", + "main": "lib/index.js", "scripts": { - "build": "babel src --out-dir . --ignore __tests__", - "watch": "babel -w src --out-dir . --ignore __tests__", + "build": "babel src --out-dir lib --ignore __tests__", + "watch": "babel -w src --out-dir lib --ignore __tests__", "prepublish": "cross-env NODE_ENV=production npm run build" } } diff --git a/packages/gatsby-cli/src/.gitkeep b/packages/gatsby-cli/src/.gitkeep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/gatsby-cli/src/create-cli.js b/packages/gatsby-cli/src/create-cli.js new file mode 100644 index 0000000000000..a72a5d15f5e5a --- /dev/null +++ b/packages/gatsby-cli/src/create-cli.js @@ -0,0 +1,194 @@ +const path = require(`path`) +const resolveCwd = require(`resolve-cwd`) +const yargs = require(`yargs`) +const report = require(`./reporter`) + +const DEFAULT_BROWSERS = [`> 1%`, `last 2 versions`, `IE >= 9`] + +const handlerP = fn => (...args) => { + Promise.resolve(fn(...args)).then( + () => process.exit(0), + err => report.panic(err) + ) +} + +function buildLocalCommands(cli, isLocalSite) { + const defaultHost = `localhost` + const directory = path.resolve(`.`) + + let siteInfo = { directory, browserslist: DEFAULT_BROWSERS } + if (isLocalSite) { + const json = require(path.join(directory, `package.json`)) + siteInfo.sitePackageJson = json + siteInfo.browserslist = json.browserslist || siteInfo.browserslist + } + + function resolveLocalCommand(command) { + if (!isLocalSite) { + cli.showHelp() + report.verbose(`current directory: ${directory}`) + return report.panic( + `gatsby <${command}> can only be run for a gatsby site. \n` + + `Either the current working directory does not contain a package.json or ` + + `'gatsby' is not specified as a dependency` + ) + } + + try { + const cmdPath = + resolveCwd.silent(`gatsby/dist/commands/${command}`) || + // Old location of commands + resolveCwd.silent(`gatsby/dist/utils/${command}`) + if (!cmdPath) + return report.panic( + `There was a problem loading the local ${command} command. Gatsby may not be installed.` + ) + + report.verbose(`loading local command from: ${cmdPath}`) + return require(cmdPath) + } catch (err) { + cli.showHelp() + return report.panic( + `There was a problem loading the local ${command} command. Gatsby may not be installed.`, + err + ) + } + } + + function getCommandHandler(command, handler) { + return argv => { + report.setVerbose(!!argv.verbose) + + process.env.gatsby_log_level = argv.verbose ? `verbose` : `normal` + report.verbose(`set gatsby_log_level: "${process.env.gatsby_log_level}"`) + + process.env.gatsby_executing_command = command + report.verbose(`set gatsby_executing_command: "${command}"`) + + let localCmd = resolveLocalCommand(command) + let args = { ...argv, ...siteInfo } + + report.verbose(`running command: ${command}`) + return handler ? handler(args, localCmd) : localCmd(args) + } + } + + cli.command({ + command: `develop`, + desc: + `Start development server. Watches files, rebuilds, and hot reloads ` + + `if something changes`, + builder: _ => + _.option(`H`, { + alias: `host`, + type: `string`, + default: defaultHost, + describe: `Set host. Defaults to ${defaultHost}`, + }) + .option(`p`, { + alias: `port`, + type: `string`, + default: `8000`, + describe: `Set port. Defaults to 8000`, + }) + .option(`o`, { + alias: `open`, + type: `boolean`, + describe: `Open the site in your browser for you.`, + }), + handler: getCommandHandler(`develop`), + }) + + cli.command({ + command: `build`, + desc: `Build a Gatsby project.`, + builder: _ => + _.option(`prefix-paths`, { + type: `boolean`, + default: false, + describe: `Build site with link paths prefixed (set prefix in your config).`, + }), + handler: handlerP( + getCommandHandler(`build`, (args, cmd) => { + process.env.NODE_ENV = `production` + return cmd(args) + }) + ), + }) + + cli.command({ + command: `serve`, + desc: `Serve previously built Gatsby site.`, + builder: _ => + _.option(`H`, { + alias: `host`, + type: `string`, + default: defaultHost, + describe: `Set host. Defaults to ${defaultHost}`, + }) + .option(`p`, { + alias: `port`, + type: `string`, + default: `9000`, + describe: `Set port. Defaults to 9000`, + }) + .option(`o`, { + alias: `open`, + type: `boolean`, + describe: `Open the site in your browser for you.`, + }), + + handler: getCommandHandler(`serve`), + }) +} + +function isLocalGatsbySite() { + let inGatsbySite = false + try { + let { dependencies, devDependencies } = require(path.resolve( + `./package.json` + )) + inGatsbySite = + (dependencies && dependencies.gatsby) || + (devDependencies && devDependencies.gatsby) + } catch (err) { + /* ignore */ + } + return inGatsbySite +} + +module.exports = (argv, handlers) => { + let cli = yargs() + let isLocalSite = isLocalGatsbySite() + + cli + .usage(`Usage: $0 [options]`) + .help(`h`) + .alias(`h`, `help`) + .version() + .alias(`v`, `version`) + .option(`verbose`, { + default: false, + type: `boolean`, + describe: `Turn on verbose output`, + global: true, + }) + + buildLocalCommands(cli, isLocalSite) + + return cli + .command({ + command: `new [rootPath] [starter]`, + desc: `Create new Gatsby project.`, + handler: handlerP( + ({ rootPath, starter = `gatsbyjs/gatsby-starter-default` }) => { + const initStarter = require(`./init-starter`) + return initStarter(starter, { rootPath }) + } + ), + }) + .wrap(cli.terminalWidth()) + .demandCommand(1, `Pass --help to see all available commands and options.`) + .showHelpOnFail(true, `A command is required.`) + .parse(argv.slice(2)) +} diff --git a/packages/gatsby-cli/src/index.js b/packages/gatsby-cli/src/index.js index 58a0725060d05..69f98d3bf4a5e 100755 --- a/packages/gatsby-cli/src/index.js +++ b/packages/gatsby-cli/src/index.js @@ -4,145 +4,34 @@ // use require() with backtick strings so use the es6 syntax import "babel-polyfill" -const program = require(`commander`) -const packageJson = require(`./package.json`) -const path = require(`path`) -const _ = require(`lodash`) -const resolveCwd = require(`resolve-cwd`) +const createCli = require(`./create-cli`) +const report = require(`./reporter`) -program.version(packageJson.version).usage(`[command] [options]`) +global.Promise = require(`bluebird`) -let inGatsbySite = false -let localPackageJSON -try { - localPackageJSON = require(path.resolve(`./package.json`)) - if ( - (localPackageJSON.dependencies && localPackageJSON.dependencies.gatsby) || - (localPackageJSON.devDependencies && - localPackageJSON.devDependencies.gatsby) - ) { - inGatsbySite = true - } -} catch (err) { - // ignore -} - -const defaultHost = `localhost` - -const directory = path.resolve(`.`) -const getSiteInfo = () => { - const sitePackageJson = require(path.join(directory, `package.json`)) - const browserslist = sitePackageJson.browserslist || [ - `> 1%`, - `last 2 versions`, - `IE >= 9`, - ] - return { sitePackageJson, browserslist } -} - -// If there's a package.json in the current directory w/ a gatsby dependency -// include the develop/build/serve commands. Otherwise, just the new. -if (inGatsbySite) { - program - .command(`develop`) - .description( - `Start development server. Watches files and rebuilds and hot reloads ` + - `if something changes` - ) // eslint-disable-line max-len - .option( - `-H, --host `, - `Set host. Defaults to ${defaultHost}`, - defaultHost - ) - .option(`-p, --port `, `Set port. Defaults to 8000`, `8000`) - .option(`-o, --open`, `Open the site in your browser for you.`) - .action(command => { - const developPath = resolveCwd(`gatsby/dist/utils/develop`) - const develop = require(developPath) - const { sitePackageJson, browserslist } = getSiteInfo() - const p = { - ...command, - directory, - sitePackageJson, - browserslist, - } - develop(p) - }) - - program - .command(`build`) - .description(`Build a Gatsby project.`) - .option( - `--prefix-paths`, - `Build site with link paths prefixed (set prefix in your config).` - ) - .action(command => { - // Set NODE_ENV to 'production' - process.env.NODE_ENV = `production` - - const buildPath = resolveCwd(`gatsby/dist/utils/build`) - const build = require(buildPath) - const { sitePackageJson, browserslist } = getSiteInfo() - const p = { - ...command, - directory, - sitePackageJson, - browserslist, - } - build(p).then(() => { - console.log(`Done building in`, process.uptime(), `seconds`) - process.exit() - }) - }) +const version = process.version +const verDigit = Number(version.match(/\d+/)[0]) - program - .command(`serve`) - .description(`Serve built site.`) - .option( - `-H, --host `, - `Set host. Defaults to ${defaultHost}`, - defaultHost - ) - .option(`-p, --port `, `Set port. Defaults to 9000`, `9000`) - .option(`-o, --open`, `Open the site in your browser for you.`) - .action(command => { - const servePath = resolveCwd(`gatsby/dist/utils/serve`) - const serve = require(servePath) - const { sitePackageJson, browserslist } = getSiteInfo() - const p = { - ...command, - directory, - sitePackageJson, - browserslist, - } - serve(p) - }) +if (verDigit < 4) { + report.panic( + `Gatsby 1.0+ requires node.js v4 or higher (you have ${version}). \n` + + `Upgrade node to the latest stable release.` + ) } -program - .command(`new [rootPath] [starter]`) - .description(`Create new Gatsby project.`) - .action((rootPath, starter) => { - const newCommand = require(`./new`) - newCommand(rootPath, starter) - }) - -program.on(`--help`, () => { - console.log( - `To show subcommand help: +Promise.onPossiblyUnhandledRejection(error => { + report.error(error) + throw error +}) - gatsby [command] -h -` - ) +process.on(`unhandledRejection`, error => { + // This will exit the process in newer Node anyway so lets be consistent + // across versions and crash + report.panic(`UNHANDLED REJECTION`, error) }) -// If the user types an unknown sub-command, just display the help. -const subCmd = process.argv.slice(2, 3)[0] -let cmds = _.map(program.commands, `_name`) -cmds = cmds.concat([`--version`, `-V`]) +process.on(`uncaughtException`, error => { + report.panic(`UNHANDLED EXCEPTION`, error) +}) -if (!_.includes(cmds, subCmd)) { - program.help() -} else { - program.parse(process.argv) -} +createCli(process.argv) diff --git a/packages/gatsby-cli/src/init-starter.js b/packages/gatsby-cli/src/init-starter.js index e14dcfeb6c645..28ccc26c4de1b 100644 --- a/packages/gatsby-cli/src/init-starter.js +++ b/packages/gatsby-cli/src/init-starter.js @@ -1,10 +1,15 @@ -/* @flow weak */ -import { exec, execSync } from "child_process" -import hostedGitInfo from "hosted-git-info" -import fs from "fs-extra" -import sysPath from "path" - -let logger = console +/* @flow */ +const { execSync } = require(`child_process`) +const execa = require(`execa`) +const hostedGitInfo = require(`hosted-git-info`) +const fs = require(`fs-extra`) +const sysPath = require(`path`) +const report = require(`./reporter`) + +const spawn = (cmd: string) => { + const [file, ...args] = cmd.split(/\s+/) + return execa(file, args, { stdio: `inherit` }) +} // Checks the existence of yarn package // We use yarnpkg instead of yarn to avoid conflict with Hadoop yarn @@ -20,113 +25,77 @@ const shouldUseYarn = () => { } } -// Executes `npm install` and `bower install` in rootPath. -// -// rootPath - String. Path to directory in which command will be executed. -// callback - Function. Takes stderr and stdout of executed process. -// -// Returns nothing. -const install = (rootPath, callback) => { +// Executes `npm install` or `yarn install` in rootPath. +const install = async rootPath => { const prevDir = process.cwd() - logger.log(`Installing packages...`) + + report.info(`Installing packages...`) process.chdir(rootPath) - const installCmd = shouldUseYarn() ? `yarnpkg` : `npm install` - exec(installCmd, (error, stdout, stderr) => { + + try { + let cmd = shouldUseYarn() ? spawn(`yarnpkg`) : spawn(`npm install`) + await cmd + } finally { process.chdir(prevDir) - if (stdout) console.log(stdout.toString()) - if (error !== null) { - const msg = stderr.toString() - callback(new Error(msg)) - } - callback(null, stdout) - }) + } } const ignored = path => !/^\.(git|hg)$/.test(sysPath.basename(path)) // Copy starter from file system. -// -// starterPath - String, file system path from which files will be taken. -// rootPath - String, directory to which starter files will be copied. -// callback - Function. -// -// Returns nothing. -const copy = (starterPath, rootPath, callback) => { - const copyDirectory = () => { - fs.copy(starterPath, rootPath, { filter: ignored }, error => { - if (error !== null) return callback(new Error(error)) - logger.log(`Created starter directory layout`) - install(rootPath, callback) - return false - }) - } - +const copy = async (starterPath: string, rootPath: string) => { // Chmod with 755. // 493 = parseInt('755', 8) - fs.mkdirp(rootPath, { mode: 493 }, error => { - if (error !== null) callback(new Error(error)) - return fs.exists(starterPath, exists => { - if (!exists) { - const chmodError = `starter ${starterPath} doesn't exist` - return callback(new Error(chmodError)) - } - logger.log(`Copying local starter to ${rootPath} ...`) - - copyDirectory() - return true - }) - }) + await fs.mkdirp(rootPath, { mode: 493 }) + + if (!fs.existsSync(starterPath)) { + throw new Error(`starter ${starterPath} doesn't exist`) + } + report.info(`Creating new site from local starter: ${starterPath}`) + + report.log(`Copying local starter to ${rootPath} ...`) + + await fs.copy(starterPath, rootPath, { filter: ignored }) + + report.success(`Created starter directory layout`) + + await install(rootPath) + + return true } // Clones starter from URI. -// -// address - String, URI. https:, github: or git: may be used. -// rootPath - String, directory to which starter files will be copied. -// callback - Function. -// -// Returns nothing. -const clone = (hostInfo, rootPath, callback) => { +const clone = async (hostInfo: any, rootPath: string) => { const url = hostInfo.git({ noCommittish: true }) const branch = hostInfo.committish ? `-b ${hostInfo.committish}` : `` - logger.log(`Cloning git repo ${url} to ${rootPath}...`) - const cmd = `git clone ${branch} ${url} ${rootPath} --single-branch` - - exec(cmd, (error, stdout, stderr) => { - if (error !== null) { - return callback(new Error(`Git clone error: ${stderr.toString()}`)) - } - logger.log(`Created starter directory layout`) - return fs.remove(sysPath.join(rootPath, `.git`), removeError => { - if (error !== null) return callback(new Error(removeError)) - install(rootPath, callback) - return true - }) - }) -} + report.info(`Creating new site from git: ${url}`) -// Main function that clones or copies the starter. -// -// starter - String, file system path or URI of starter. -// rootPath - String, directory to which starter files will be copied. -// callback - Function. -// -// Returns nothing. -const initStarter = (starter, options = {}) => - new Promise((resolve, reject) => { - const callback = (err, value) => (err ? reject(err) : resolve(value)) + await spawn(`git clone ${branch} ${url} ${rootPath} --single-branch`) + + report.success(`Created starter directory layout`) - const cwd = process.cwd() - const rootPath = options.rootPath || cwd - if (options.logger) logger = options.logger + await fs.remove(sysPath.join(rootPath, `.git`)) - if (fs.existsSync(sysPath.join(rootPath, `package.json`))) - throw new Error(`Directory ${rootPath} is already an npm project`) + await install(rootPath) +} - const hostedInfo = hostedGitInfo.fromUrl(starter) +type InitOptions = { + rootPath?: string, +} - if (hostedInfo) clone(hostedInfo, rootPath, callback) - else copy(starter, rootPath, callback) - }) +/** + * Main function that clones or copies the starter. + */ +module.exports = async (starter: string, options: InitOptions = {}) => { + const rootPath = options.rootPath || process.cwd() -module.exports = initStarter + if (fs.existsSync(sysPath.join(rootPath, `package.json`))) { + report.panic(`Directory ${rootPath} is already an npm project`) + return + } + + const hostedInfo = hostedGitInfo.fromUrl(starter) + if (hostedInfo) await clone(hostedInfo, rootPath) + else await copy(starter, rootPath) +} diff --git a/packages/gatsby-cli/src/new.js b/packages/gatsby-cli/src/new.js deleted file mode 100644 index afa14d139110e..0000000000000 --- a/packages/gatsby-cli/src/new.js +++ /dev/null @@ -1,8 +0,0 @@ -/* @flow weak */ -const logger = require(`tracer`).colorConsole() - -const initStarter = require(`./init-starter`) - -module.exports = (rootPath, starter = `gatsbyjs/gatsby-starter-default`) => { - initStarter(starter, { rootPath, logger }).catch(error => logger.error(error)) -} diff --git a/packages/gatsby/src/reporter/errors.js b/packages/gatsby-cli/src/reporter/errors.js similarity index 100% rename from packages/gatsby/src/reporter/errors.js rename to packages/gatsby-cli/src/reporter/errors.js diff --git a/packages/gatsby/src/reporter/index.js b/packages/gatsby-cli/src/reporter/index.js similarity index 86% rename from packages/gatsby/src/reporter/index.js rename to packages/gatsby-cli/src/reporter/index.js index 44cd3c3b5426f..30366545adc39 100644 --- a/packages/gatsby/src/reporter/index.js +++ b/packages/gatsby-cli/src/reporter/index.js @@ -5,15 +5,17 @@ const { stripIndent } = require(`common-tags`) const convertHrtime = require(`convert-hrtime`) const { getErrorFormatter } = require(`./errors`) +const VERBOSE = process.env.gatsby_log_level === `verbose` + const errorFormatter = getErrorFormatter() -const reporter = createReporter({ emoji: true }) +const reporter = createReporter({ emoji: true, verbose: VERBOSE }) const base = Object.getPrototypeOf(reporter) module.exports = Object.assign(reporter, { stripIndent, - setVerbose(isVerbose) { - this.isVerbose = true + setVerbose(isVerbose = true) { + this.isVerbose = !!isVerbose }, panic(...args) { diff --git a/packages/gatsby/src/reporter/prepare-stack-trace.js b/packages/gatsby-cli/src/reporter/prepare-stack-trace.js similarity index 100% rename from packages/gatsby/src/reporter/prepare-stack-trace.js rename to packages/gatsby-cli/src/reporter/prepare-stack-trace.js diff --git a/packages/gatsby-dev-cli/package.json b/packages/gatsby-dev-cli/package.json index 5187179151a9e..d7f60e2feff1c 100644 --- a/packages/gatsby-dev-cli/package.json +++ b/packages/gatsby-dev-cli/package.json @@ -6,7 +6,7 @@ "fs-extra": "^4.0.1", "is-absolute": "^0.2.6", "lodash": "^4.17.4", - "yargs": "^8.0.1" + "yargs": "^8.0.2" }, "name": "gatsby-dev-cli", "version": "1.2.6", diff --git a/packages/gatsby-plugin-canonical-urls/src/gatsby-ssr.js b/packages/gatsby-plugin-canonical-urls/src/gatsby-ssr.js index a195c46956fe6..82ec4ae684c97 100644 --- a/packages/gatsby-plugin-canonical-urls/src/gatsby-ssr.js +++ b/packages/gatsby-plugin-canonical-urls/src/gatsby-ssr.js @@ -1,6 +1,9 @@ import React from "react" -exports.onRenderBody = ({ setHeadComponents, pathname = `/` }, pluginOptions) => { +exports.onRenderBody = ( + { setHeadComponents, pathname = `/` }, + pluginOptions +) => { const url = `${pluginOptions.siteUrl}${pathname}` setHeadComponents([]) } diff --git a/packages/gatsby-plugin-styletron/src/gatsby-browser.js b/packages/gatsby-plugin-styletron/src/gatsby-browser.js index 405594b596b25..26aa113d9977f 100644 --- a/packages/gatsby-plugin-styletron/src/gatsby-browser.js +++ b/packages/gatsby-plugin-styletron/src/gatsby-browser.js @@ -8,4 +8,4 @@ exports.wrapRootComponent = ({ Root }) => () => ( -) \ No newline at end of file +) diff --git a/packages/gatsby-plugin-styletron/src/gatsby-ssr.js b/packages/gatsby-plugin-styletron/src/gatsby-ssr.js index e2bc2b186e7a3..bc4db43737092 100644 --- a/packages/gatsby-plugin-styletron/src/gatsby-ssr.js +++ b/packages/gatsby-plugin-styletron/src/gatsby-ssr.js @@ -3,23 +3,25 @@ const Styletron = require(`styletron-server`) const { StyletronProvider } = require(`styletron-react`) const { renderToString } = require(`react-dom/server`) -exports.replaceRenderer = ({ bodyComponent, setHeadComponents, replaceBodyHTMLString }) => { +exports.replaceRenderer = ({ + bodyComponent, + setHeadComponents, + replaceBodyHTMLString, +}) => { const styletron = new Styletron() const app = ( - - {bodyComponent} - + {bodyComponent} ) replaceBodyHTMLString(renderToString(app)) const stylesheets = styletron.getStylesheets() const headComponents = stylesheets.map((sheet, index) => ( - - )) + + )) setHeadComponents(headComponents) } diff --git a/packages/gatsby-source-wordpress/.gitignore b/packages/gatsby-source-wordpress/.gitignore index 50fa510165acd..d2489a33c69f4 100644 --- a/packages/gatsby-source-wordpress/.gitignore +++ b/packages/gatsby-source-wordpress/.gitignore @@ -1,18 +1,3 @@ -# Dependency directory -node_modules - -# Build Path of Test Fixtures -test/**/public -.DS_Store - -# IDE specific -.vscode/ - -# Package managers -yarn.lock -package-lock.json - /*.js -!index.js yarn.lock scripts diff --git a/packages/gatsby-transformer-json/src/gatsby-node.js b/packages/gatsby-transformer-json/src/gatsby-node.js index 91c6498fdcc4a..858d8ef1ead16 100644 --- a/packages/gatsby-transformer-json/src/gatsby-node.js +++ b/packages/gatsby-transformer-json/src/gatsby-node.js @@ -4,23 +4,23 @@ const path = require(`path`) async function onCreateNode({ node, boundActionCreators, loadNodeContent }) { function transformObject(obj, id, type) { - const objStr = JSON.stringify(obj) - const contentDigest = crypto - .createHash(`md5`) - .update(objStr) - .digest(`hex`) - const jsonNode = { - ...obj, - id, - children: [], - parent: node.id, - internal: { - contentDigest, - type, - }, - } - createNode(jsonNode) - createParentChildLink({ parent: node, child: jsonNode }) + const objStr = JSON.stringify(obj) + const contentDigest = crypto + .createHash(`md5`) + .update(objStr) + .digest(`hex`) + const jsonNode = { + ...obj, + id, + children: [], + parent: node.id, + internal: { + contentDigest, + type, + }, + } + createNode(jsonNode) + createParentChildLink({ parent: node, child: jsonNode }) } const { createNode, createParentChildLink } = boundActionCreators @@ -38,15 +38,14 @@ async function onCreateNode({ node, boundActionCreators, loadNodeContent }) { transformObject( obj, obj.id ? obj.id : `${node.id} [${i}] >>> JSON`, - _.upperFirst(_.camelCase(`${node.name} Json`)), + _.upperFirst(_.camelCase(`${node.name} Json`)) ) }) - } - else if (_.isPlainObject(parsedContent)) { + } else if (_.isPlainObject(parsedContent)) { transformObject( parsedContent, parsedContent.id ? parsedContent.id : `${node.id} >>> JSON`, - _.upperFirst(_.camelCase(`${path.basename(node.dir)} Json`)), + _.upperFirst(_.camelCase(`${path.basename(node.dir)} Json`)) ) } } diff --git a/packages/gatsby-transformer-yaml/src/gatsby-node.js b/packages/gatsby-transformer-yaml/src/gatsby-node.js index d4ba02f1e17e6..d119fb20b3ecf 100644 --- a/packages/gatsby-transformer-yaml/src/gatsby-node.js +++ b/packages/gatsby-transformer-yaml/src/gatsby-node.js @@ -5,23 +5,23 @@ const path = require(`path`) async function onCreateNode({ node, boundActionCreators, loadNodeContent }) { function transformObject(obj, id, type) { - const objStr = JSON.stringify(obj) - const contentDigest = crypto - .createHash(`md5`) - .update(objStr) - .digest(`hex`) - const yamlNode = { - ...obj, - id, - children: [], - parent: node.id, - internal: { - contentDigest, - type, - }, - } - createNode(yamlNode) - createParentChildLink({ parent: node, child: yamlNode }) + const objStr = JSON.stringify(obj) + const contentDigest = crypto + .createHash(`md5`) + .update(objStr) + .digest(`hex`) + const yamlNode = { + ...obj, + id, + children: [], + parent: node.id, + internal: { + contentDigest, + type, + }, + } + createNode(yamlNode) + createParentChildLink({ parent: node, child: yamlNode }) } const { createNode, createParentChildLink } = boundActionCreators @@ -38,15 +38,14 @@ async function onCreateNode({ node, boundActionCreators, loadNodeContent }) { transformObject( obj, obj.id ? obj.id : `${node.id} [${i}] >>> YAML`, - _.upperFirst(_.camelCase(`${node.name} Yaml`)), + _.upperFirst(_.camelCase(`${node.name} Yaml`)) ) }) - } - else if (_.isPlainObject(parsedContent)) { + } else if (_.isPlainObject(parsedContent)) { transformObject( parsedContent, parsedContent.id ? parsedContent.id : `${node.id} >>> YAML`, - _.upperFirst(_.camelCase(`${path.basename(node.dir)} Yaml`)), + _.upperFirst(_.camelCase(`${path.basename(node.dir)} Yaml`)) ) } } diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index f722bae4cdf0c..b8ab4a37cedb6 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -4,7 +4,7 @@ "version": "1.9.55", "author": "Kyle Mathews ", "bin": { - "gatsby": "./dist/gatsby-cli.js" + "gatsby": "./bin/gatsby.js" }, "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" @@ -26,7 +26,6 @@ "babylon": "^6.17.3", "bluebird": "^3.5.0", "boom": "^2.7.2", - "bundle-loader": "^0.5.4", "chalk": "^1.1.3", "chokidar": "^1.7.0", "chunk-manifest-webpack-plugin": "0.1.0", @@ -53,6 +52,7 @@ "gatsby-1-config-css-modules": "^1.0.4", "gatsby-module-loader": "^1.0.7", "gatsby-react-router-scroll": "^1.0.2", + "gatsby-cli": "^1.1.5", "glob": "^7.1.1", "graphql": "^0.10.3", "graphql-relay": "^0.5.1", @@ -60,7 +60,6 @@ "gray-matter": "^2.1.0", "hapi": "^8.5.1", "history": "^4.6.2", - "hosted-git-info": "^2.4.2", "invariant": "^2.2.2", "is-relative": "^0.2.1", "is-relative-url": "^2.0.0", @@ -79,7 +78,6 @@ "node-libs-browser": "^2.0.0", "normalize-path": "^2.1.1", "null-loader": "^0.1.1", - "object-assign": "^4.1.0", "observable": "^2.1.4", "opn": "^5.1.0", "parse-filepath": "^1.0.1", @@ -89,7 +87,6 @@ "postcss-import": "^8.2.0", "postcss-loader": "^0.13.0", "postcss-reporter": "^1.4.1", - "pretty-error": "^2.1.1", "raw-loader": "^0.5.1", "react": "^15.6.0", "react-dom": "^15.6.0", @@ -99,16 +96,12 @@ "redux": "^3.6.0", "relay-compiler": "1.3.0", "remote-redux-devtools": "^0.5.7", - "resolve-cwd": "^2.0.0", "sift": "^3.2.6", "slash": "^1.0.0", "socket.io": "^2.0.3", - "source-map": "^0.5.7", - "stack-trace": "^0.0.10", "static-site-generator-webpack-plugin": "^3.4.1", "string-similarity": "^1.2.0", "style-loader": "^0.13.0", - "tracer": "^0.8.9", "type-of": "^2.0.1", "underscore.string": "^3.3.4", "url-loader": "^0.5.7", @@ -120,8 +113,7 @@ "webpack-md5-hash": "0.0.5", "webpack-stats-plugin": "^0.1.4", "webpack-validator": "^2.2.7", - "yaml-loader": "^0.4.0", - "yurnalist": "^0.1.10" + "yaml-loader": "^0.4.0" }, "devDependencies": { "babel-cli": "^6.26.0", @@ -152,8 +144,7 @@ "url": "git+https://github.com/gatsbyjs/gatsby.git" }, "scripts": { - "build": "rimraf dist && npm run build:src && npm run build:cli && npm run build:internal-plugins && npm run build:rawfiles", - "build:cli": "babel src/gatsby-cli.js --out-file dist/gatsby-cli.js --presets es2015", + "build": "rimraf dist && npm run build:src && npm run build:internal-plugins && npm run build:rawfiles", "build:internal-plugins": "copyfiles -u 1 src/internal-plugins/**/package.json dist", "build:rawfiles": "copyfiles -u 1 src/internal-plugins/**/raw_* dist", "build:src": "babel src --out-dir dist --source-maps --ignore gatsby-cli.js,raw_*,__tests__", diff --git a/packages/gatsby/src/bin/cli.js b/packages/gatsby/src/bin/cli.js deleted file mode 100644 index 9b5545d15ecf1..0000000000000 --- a/packages/gatsby/src/bin/cli.js +++ /dev/null @@ -1,165 +0,0 @@ -// babel-preset-env doesn't find this import if you -// use require() with backtick strings so use the es6 syntax -import "babel-polyfill" - -const program = require(`commander`) -const packageJson = require(`../../package.json`) -const path = require(`path`) -const _ = require(`lodash`) -const Promise = require(`bluebird`) -const resolveCwd = require(`resolve-cwd`) - -const report = require(`../reporter`) - -// Improve Promise error handling. Maybe... what's the best -// practice for this these days? -global.Promise = require(`bluebird`) - -Promise.onPossiblyUnhandledRejection(error => { - report.error(error) - throw error -}) - -process.on(`unhandledRejection`, error => { - // This will exit the process in newer Node anyway so lets be consistent - // across versions and crash - report.panic(`UNHANDLED REJECTION`, error) -}) - -process.on(`uncaughtException`, error => { - report.panic(`UNHANDLED EXCEPTION`, error) -}) - -const defaultHost = `localhost` - -let inGatsbySite = false -let localPackageJSON -try { - localPackageJSON = require(path.resolve(`./package.json`)) - if (localPackageJSON.dependencies && localPackageJSON.dependencies.gatsby) { - inGatsbySite = true - } -} catch (err) { - // ignore -} - -const directory = path.resolve(`.`) -const getSiteInfo = () => { - const sitePackageJson = require(path.join(directory, `package.json`)) - const browserslist = sitePackageJson.browserslist || [ - `> 1%`, - `last 2 versions`, - `IE >= 9`, - ] - return { sitePackageJson, browserslist } -} - -program.version(packageJson.version).usage(`[command] [options]`) - -// If there's a package.json in the current directory w/ a gatsby dependency -// include the develop/build/serve commands. Otherwise, just the new. -if (inGatsbySite) { - program - .command(`develop`) - .description( - `Start development server. Watches files and rebuilds and hot reloads ` + - `if something changes` - ) // eslint-disable-line max-len - .option( - `-H, --host `, - `Set host. Defaults to ${defaultHost}`, - defaultHost - ) - .option(`-p, --port `, `Set port. Defaults to 8000`, `8000`) - .option(`-o, --open`, `Open the site in your browser for you.`) - .action(command => { - const developPath = resolveCwd(`gatsby/dist/utils/develop`) - const develop = require(developPath) - // console.timeEnd(`time to load develop`) - const { sitePackageJson, browserslist } = getSiteInfo() - const p = { - ...command, - directory, - sitePackageJson, - browserslist, - } - develop(p) - }) - - program - .command(`build`) - .description(`Build a Gatsby project.`) - .option( - `--prefix-paths`, - `Build site with link paths prefixed (set prefix in your config).` - ) - .action(command => { - // Set NODE_ENV to 'production' - process.env.NODE_ENV = `production` - - const buildPath = resolveCwd(`gatsby/dist/utils/build`) - const build = require(buildPath) - const { sitePackageJson, browserslist } = getSiteInfo() - const p = { - ...command, - directory, - sitePackageJson, - browserslist, - } - build(p).then(() => { - report.success(`Done building in ${process.uptime()} seconds`) - process.exit() - }) - }) - - program - .command(`serve`) - .description(`Serve built site.`) - .option( - `-H, --host `, - `Set host. Defaults to ${defaultHost}`, - defaultHost - ) - .option(`-p, --port `, `Set port. Defaults to 9000`, `9000`) - .option(`-o, --open`, `Open the site in your browser for you.`) - .action(command => { - const servePath = resolveCwd(`gatsby/dist/utils/serve`) - const serve = require(servePath) - const { sitePackageJson, browserslist } = getSiteInfo() - const p = { - ...command, - directory, - sitePackageJson, - browserslist, - } - serve(p) - }) -} - -program - .command(`new [rootPath] [starter]`) - .description(`Create new Gatsby project.`) - .action((rootPath, starter) => { - const newCommand = require(`../utils/new`) - newCommand(rootPath, starter) - }) - -program.on(`--help`, () => { - console.log( - `To show subcommand help: - - gatsby [command] -h -` - ) -}) - -// If the user types an unknown sub-command, just display the help. -const subCmd = process.argv.slice(2, 3)[0] -let cmds = _.map(program.commands, `_name`) -cmds = cmds.concat([`--version`, `-V`]) - -if (!_.includes(cmds, subCmd)) { - program.help() -} else { - program.parse(process.argv) -} diff --git a/packages/gatsby/src/bin/gatsby.js b/packages/gatsby/src/bin/gatsby.js new file mode 100644 index 0000000000000..6c430b053d924 --- /dev/null +++ b/packages/gatsby/src/bin/gatsby.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require(`gatsby-cli`) diff --git a/packages/gatsby/src/bootstrap/index.js b/packages/gatsby/src/bootstrap/index.js index 1098e9cad806c..2872a638c9ac8 100644 --- a/packages/gatsby/src/bootstrap/index.js +++ b/packages/gatsby/src/bootstrap/index.js @@ -15,7 +15,7 @@ const { graphql } = require(`graphql`) const { store, emitter } = require(`../redux`) const loadPlugins = require(`./load-plugins`) const { initCache } = require(`../utils/cache`) -const report = require(`../reporter`) +const report = require(`gatsby-cli/lib/reporter`) // Show stack trace on unhandled promises. process.on(`unhandledRejection`, (reason, p) => { @@ -40,9 +40,17 @@ const { const preferDefault = m => (m && m.default) || m -module.exports = async (program: any) => { - // Fix program directory path for windows env. - program.directory = slash(program.directory) +type BootstrapArgs = { + directory: string, + prefixPaths?: boolean, +} + +module.exports = async (args: BootstrapArgs) => { + const program = { + ...args, + // Fix program directory path for windows env. + directory: slash(args.directory), + } store.dispatch({ type: `SET_PROGRAM`, diff --git a/packages/gatsby/src/bootstrap/load-plugins.js b/packages/gatsby/src/bootstrap/load-plugins.js index 9b9953f003e66..82da423dd477d 100644 --- a/packages/gatsby/src/bootstrap/load-plugins.js +++ b/packages/gatsby/src/bootstrap/load-plugins.js @@ -8,7 +8,7 @@ const glob = require(`glob`) const { store } = require(`../redux`) const nodeAPIs = require(`../utils/api-node-docs`) const testRequireError = require(`../utils/test-require-error`) -const report = require(`../reporter`) +const report = require(`gatsby-cli/lib/reporter`) function createFileContentHash(root, globPattern) { const hash = crypto.createHash(`md5`) diff --git a/packages/gatsby/src/utils/build-css.js b/packages/gatsby/src/commands/build-css.js similarity index 84% rename from packages/gatsby/src/utils/build-css.js rename to packages/gatsby/src/commands/build-css.js index abf9fd1b11f32..a2f1ff6329348 100644 --- a/packages/gatsby/src/utils/build-css.js +++ b/packages/gatsby/src/commands/build-css.js @@ -1,8 +1,7 @@ /* @flow */ -import webpack from "webpack" -import fs from "fs-extra" -import Promise from "bluebird" -import webpackConfig from "./webpack.config" +const webpack = require(`webpack`) +const fs = require(`fs-extra`) +const webpackConfig = require(`../utils/webpack.config`) module.exports = async (program: any) => { const { directory } = program diff --git a/packages/gatsby/src/utils/build-html.js b/packages/gatsby/src/commands/build-html.js similarity index 85% rename from packages/gatsby/src/utils/build-html.js rename to packages/gatsby/src/commands/build-html.js index 78e7531d00ae9..08ee5668d971b 100644 --- a/packages/gatsby/src/utils/build-html.js +++ b/packages/gatsby/src/commands/build-html.js @@ -1,10 +1,9 @@ /* @flow */ -import webpack from "webpack" -import Promise from "bluebird" -import fs from "fs" -import webpackConfig from "./webpack.config" +const webpack = require(`webpack`) +const fs = require(`fs`) +const webpackConfig = require(`../utils/webpack.config`) const { store } = require(`../redux`) -const { createErrorFromString } = require(`../reporter/errors`) +const { createErrorFromString } = require(`gatsby-cli/lib/reporter/errors`) const debug = require(`debug`)(`gatsby:html`) diff --git a/packages/gatsby/src/utils/build-javascript.js b/packages/gatsby/src/commands/build-javascript.js similarity index 72% rename from packages/gatsby/src/utils/build-javascript.js rename to packages/gatsby/src/commands/build-javascript.js index f51570b0ad4af..842d52ca31a91 100644 --- a/packages/gatsby/src/utils/build-javascript.js +++ b/packages/gatsby/src/commands/build-javascript.js @@ -1,7 +1,6 @@ /* @flow */ -import webpack from "webpack" -import Promise from "bluebird" -import webpackConfig from "./webpack.config" +const webpack = require(`webpack`) +const webpackConfig = require(`../utils/webpack.config`) module.exports = async program => { const { directory } = program diff --git a/packages/gatsby/src/utils/build.js b/packages/gatsby/src/commands/build.js similarity index 83% rename from packages/gatsby/src/utils/build.js rename to packages/gatsby/src/commands/build.js index 1e3e82238d5e4..1e556364d1ed1 100644 --- a/packages/gatsby/src/utils/build.js +++ b/packages/gatsby/src/commands/build.js @@ -1,10 +1,10 @@ /* @flow */ +const report = require(`gatsby-cli/lib/reporter`) const buildCSS = require(`./build-css`) const buildHTML = require(`./build-html`) const buildProductionBundle = require(`./build-javascript`) const bootstrap = require(`../bootstrap`) -const report = require(`../reporter`) const apiRunnerNode = require(`./api-runner-node`) const copyStaticDirectory = require(`./copy-static-directory`) @@ -13,7 +13,14 @@ function reportFailure(msg, err: Error) { report.panic(msg, err) } -async function html(program: any) { +type BuildArgs = { + directory: string, + sitePackageJson: object, + browserslist: string[], + prefixPaths: boolean, +} + +module.exports = async function build(program: BuildArgs) { const { graphqlRunner } = await bootstrap(program) await apiRunnerNode(`onPreBuild`, { graphql: graphqlRunner }) @@ -51,6 +58,6 @@ async function html(program: any) { activity.end() await apiRunnerNode(`onPostBuild`, { graphql: graphqlRunner }) -} -module.exports = html + report.info(`Done building in ${process.uptime()} sec`) +} diff --git a/packages/gatsby/src/utils/develop-html.js b/packages/gatsby/src/commands/develop-html.js similarity index 87% rename from packages/gatsby/src/utils/develop-html.js rename to packages/gatsby/src/commands/develop-html.js index 14adde41c6516..d3d6d7845fe3d 100644 --- a/packages/gatsby/src/utils/develop-html.js +++ b/packages/gatsby/src/commands/develop-html.js @@ -1,10 +1,9 @@ /* @flow */ -const webpack = require(`webpack`) -const Promise = require(`bluebird`) const fs = require(`fs`) -const webpackConfig = require(`./webpack.config`) -const { createErrorFromString } = require(`../reporter/errors`) +const webpack = require(`webpack`) +const { createErrorFromString } = require(`gatsby-cli/lib/reporter/errors`) const debug = require(`debug`)(`gatsby:html`) +const webpackConfig = require(`../utils/webpack.config`) module.exports = async (program: any) => { const { directory } = program diff --git a/packages/gatsby/src/utils/develop.js b/packages/gatsby/src/commands/develop.js similarity index 96% rename from packages/gatsby/src/utils/develop.js rename to packages/gatsby/src/commands/develop.js index 0d4713958d228..04b400c8a9a4a 100644 --- a/packages/gatsby/src/utils/develop.js +++ b/packages/gatsby/src/commands/develop.js @@ -1,19 +1,19 @@ /* @flow */ +const chokidar = require(`chokidar`) const express = require(`express`) const graphqlHTTP = require(`express-graphql`) +const parsePath = require(`parse-filepath`) const request = require(`request`) -const bootstrap = require(`../bootstrap`) -const chokidar = require(`chokidar`) -const webpack = require(`webpack`) -const webpackConfig = require(`./webpack.config`) const rl = require(`readline`) -const parsePath = require(`parse-filepath`) +const webpack = require(`webpack`) +const webpackConfig = require(`../utils/webpack.config`) +const bootstrap = require(`../bootstrap`) const { store } = require(`../redux`) -const copyStaticDirectory = require(`./copy-static-directory`) +const copyStaticDirectory = require(`../utils/copy-static-directory`) const developHtml = require(`./develop-html`) -const { withBasePath } = require(`./path`) -const report = require(`../reporter`) +const { withBasePath } = require(`../utils/path`) +const report = require(`gatsby-cli/lib/reporter`) // Watch the static directory and copy files to public as they're added or // changed. Wait 10 seconds so copying doesn't interfer with the regular diff --git a/packages/gatsby/src/utils/serve.js b/packages/gatsby/src/commands/serve.js similarity index 100% rename from packages/gatsby/src/utils/serve.js rename to packages/gatsby/src/commands/serve.js diff --git a/packages/gatsby/src/gatsby-cli.js b/packages/gatsby/src/gatsby-cli.js deleted file mode 100755 index c49c9cb08e52f..0000000000000 --- a/packages/gatsby/src/gatsby-cli.js +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env node -const path = require(`path`) -const fs = require(`fs`) -const _ = require(`lodash`) - -const report = require(`./reporter`) - -const version = process.version -const verDigit = Number(version.match(/\d+/)[0]) - -if (verDigit < 4) { - report.panic( - `Gatsby 1.0+ requires node.js v4 or higher (you have ${version}). \n` + - `Upgrade node to the latest stable release.` - ) -} - -/* - Get the locally installed version of gatsby/lib/bin/cli.js from the place - where this program was executed. -*/ -const cliFile = `dist/bin/cli.js` -const localPath = path.resolve(`node_modules/gatsby`, cliFile) - -const useGlobalGatsby = function() { - // Never use global install *except* for new and help commands - if (!_.includes([`new`, `--help`], process.argv[2])) { - report.panic( - `A local install of Gatsby was not found. \n` + - `You should save Gatsby as a site dependency e.g. npm install --save gatsby` - ) - } - - require(`./bin/cli`) -} - -if (fs.existsSync(localPath)) { - try { - require(localPath) - } catch (error) { - report.error(`A local install of Gatsby exists but failed to load.`, error) - } -} else { - useGlobalGatsby() -} diff --git a/packages/gatsby/src/internal-plugins/query-runner/file-parser.js b/packages/gatsby/src/internal-plugins/query-runner/file-parser.js index cf6bca3919b36..30a930c0bc9e9 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/file-parser.js +++ b/packages/gatsby/src/internal-plugins/query-runner/file-parser.js @@ -6,7 +6,7 @@ const crypto = require(`crypto`) import traverse from "babel-traverse" const babylon = require(`babylon`) -const report = require(`../../reporter`) +const report = require(`gatsby-cli/lib/reporter`) const { getGraphQLTag } = require(`../../utils/babel-plugin-extract-graphql`) import type { DocumentNode, DefinitionNode } from "graphql" diff --git a/packages/gatsby/src/internal-plugins/query-runner/graphql-errors.js b/packages/gatsby/src/internal-plugins/query-runner/graphql-errors.js index 2de845338a1da..b59ab00b34d42 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/graphql-errors.js +++ b/packages/gatsby/src/internal-plugins/query-runner/graphql-errors.js @@ -3,7 +3,7 @@ import { print, visit, GraphQLError, getLocation } from "graphql" import babelCodeFrame from "babel-code-frame" import _ from "lodash" -import report from "../../reporter" +import report from "gatsby-cli/lib/reporter" type RelayGraphQLError = Error & { validationErrors?: Object } diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js b/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js index 16ccc95c33b3b..7984b4198b0dd 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-compiler.js @@ -18,7 +18,7 @@ import { graphqlValidationError, multipleRootQueriesError, } from "./graphql-errors" -import report from "../../reporter" +import report from "gatsby-cli/lib/reporter" import type { DocumentNode, GraphQLSchema } from "graphql" diff --git a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js index 11f2c9a0acf93..d4b3b215ff7bf 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/query-runner.js @@ -1,9 +1,8 @@ import { graphql as graphqlFunction } from "graphql" const fs = require(`fs-extra`) +const report = require(`gatsby-cli/lib/reporter`) const { joinPath } = require(`../../utils/path`) -const report = require(`../../reporter`) - const { store } = require(`../../redux`) // Run query for a page diff --git a/packages/gatsby/src/schema/infer-graphql-input-fields-from-fields.js b/packages/gatsby/src/schema/infer-graphql-input-fields-from-fields.js index 402544de18981..5f4bba1fc3da6 100644 --- a/packages/gatsby/src/schema/infer-graphql-input-fields-from-fields.js +++ b/packages/gatsby/src/schema/infer-graphql-input-fields-from-fields.js @@ -18,7 +18,7 @@ const { import type { GraphQLInputType, GraphQLType } from "graphql" const _ = require(`lodash`) -const report = require(`../reporter`) +const report = require(`gatsby-cli/lib/reporter`) const createTypeName = require(`./create-type-name`) const createKey = require(`./create-key`) diff --git a/packages/gatsby/src/utils/api-runner-node.js b/packages/gatsby/src/utils/api-runner-node.js index ba4c23bc5bd92..ad51d22d67b51 100644 --- a/packages/gatsby/src/utils/api-runner-node.js +++ b/packages/gatsby/src/utils/api-runner-node.js @@ -3,7 +3,7 @@ const glob = require(`glob`) const _ = require(`lodash`) const mapSeries = require(`async/mapSeries`) -const reporter = require(`../reporter`) +const reporter = require(`gatsby-cli/lib/reporter`) const cache = require(`./cache`) const apiList = require(`./api-node-docs`) diff --git a/packages/gatsby/src/utils/babel-config.js b/packages/gatsby/src/utils/babel-config.js index e3311b5e3530e..662aa3263672a 100644 --- a/packages/gatsby/src/utils/babel-config.js +++ b/packages/gatsby/src/utils/babel-config.js @@ -4,7 +4,6 @@ import fs from "fs" import path from "path" import json5 from "json5" import _ from "lodash" -import objectAssign from "object-assign" import invariant from "invariant" import apiRunnerNode from "./api-runner-node" @@ -85,7 +84,7 @@ function normalizeConfig(config, directory) { normalizedConfig.plugins.push(normalize(plugin, `plugin`)) ) - return objectAssign({}, config, normalizedConfig) + return Object.assign({}, config, normalizedConfig) } /** diff --git a/packages/gatsby/src/utils/init-starter.js b/packages/gatsby/src/utils/init-starter.js deleted file mode 100644 index e14dcfeb6c645..0000000000000 --- a/packages/gatsby/src/utils/init-starter.js +++ /dev/null @@ -1,132 +0,0 @@ -/* @flow weak */ -import { exec, execSync } from "child_process" -import hostedGitInfo from "hosted-git-info" -import fs from "fs-extra" -import sysPath from "path" - -let logger = console - -// Checks the existence of yarn package -// We use yarnpkg instead of yarn to avoid conflict with Hadoop yarn -// Refer to https://github.com/yarnpkg/yarn/issues/673 -// -// Returns true if yarn exists, false otherwise -const shouldUseYarn = () => { - try { - execSync(`yarnpkg --version`, { stdio: `ignore` }) - return true - } catch (e) { - return false - } -} - -// Executes `npm install` and `bower install` in rootPath. -// -// rootPath - String. Path to directory in which command will be executed. -// callback - Function. Takes stderr and stdout of executed process. -// -// Returns nothing. -const install = (rootPath, callback) => { - const prevDir = process.cwd() - logger.log(`Installing packages...`) - process.chdir(rootPath) - const installCmd = shouldUseYarn() ? `yarnpkg` : `npm install` - exec(installCmd, (error, stdout, stderr) => { - process.chdir(prevDir) - if (stdout) console.log(stdout.toString()) - if (error !== null) { - const msg = stderr.toString() - callback(new Error(msg)) - } - callback(null, stdout) - }) -} - -const ignored = path => !/^\.(git|hg)$/.test(sysPath.basename(path)) - -// Copy starter from file system. -// -// starterPath - String, file system path from which files will be taken. -// rootPath - String, directory to which starter files will be copied. -// callback - Function. -// -// Returns nothing. -const copy = (starterPath, rootPath, callback) => { - const copyDirectory = () => { - fs.copy(starterPath, rootPath, { filter: ignored }, error => { - if (error !== null) return callback(new Error(error)) - logger.log(`Created starter directory layout`) - install(rootPath, callback) - return false - }) - } - - // Chmod with 755. - // 493 = parseInt('755', 8) - fs.mkdirp(rootPath, { mode: 493 }, error => { - if (error !== null) callback(new Error(error)) - return fs.exists(starterPath, exists => { - if (!exists) { - const chmodError = `starter ${starterPath} doesn't exist` - return callback(new Error(chmodError)) - } - logger.log(`Copying local starter to ${rootPath} ...`) - - copyDirectory() - return true - }) - }) -} - -// Clones starter from URI. -// -// address - String, URI. https:, github: or git: may be used. -// rootPath - String, directory to which starter files will be copied. -// callback - Function. -// -// Returns nothing. -const clone = (hostInfo, rootPath, callback) => { - const url = hostInfo.git({ noCommittish: true }) - const branch = hostInfo.committish ? `-b ${hostInfo.committish}` : `` - - logger.log(`Cloning git repo ${url} to ${rootPath}...`) - const cmd = `git clone ${branch} ${url} ${rootPath} --single-branch` - - exec(cmd, (error, stdout, stderr) => { - if (error !== null) { - return callback(new Error(`Git clone error: ${stderr.toString()}`)) - } - logger.log(`Created starter directory layout`) - return fs.remove(sysPath.join(rootPath, `.git`), removeError => { - if (error !== null) return callback(new Error(removeError)) - install(rootPath, callback) - return true - }) - }) -} - -// Main function that clones or copies the starter. -// -// starter - String, file system path or URI of starter. -// rootPath - String, directory to which starter files will be copied. -// callback - Function. -// -// Returns nothing. -const initStarter = (starter, options = {}) => - new Promise((resolve, reject) => { - const callback = (err, value) => (err ? reject(err) : resolve(value)) - - const cwd = process.cwd() - const rootPath = options.rootPath || cwd - if (options.logger) logger = options.logger - - if (fs.existsSync(sysPath.join(rootPath, `package.json`))) - throw new Error(`Directory ${rootPath} is already an npm project`) - - const hostedInfo = hostedGitInfo.fromUrl(starter) - - if (hostedInfo) clone(hostedInfo, rootPath, callback) - else copy(starter, rootPath, callback) - }) - -module.exports = initStarter diff --git a/packages/gatsby/src/utils/new.js b/packages/gatsby/src/utils/new.js deleted file mode 100644 index afa14d139110e..0000000000000 --- a/packages/gatsby/src/utils/new.js +++ /dev/null @@ -1,8 +0,0 @@ -/* @flow weak */ -const logger = require(`tracer`).colorConsole() - -const initStarter = require(`./init-starter`) - -module.exports = (rootPath, starter = `gatsbyjs/gatsby-starter-default`) => { - initStarter(starter, { rootPath, logger }).catch(error => logger.error(error)) -} diff --git a/www/src/pages/index.js b/www/src/pages/index.js index 4794bfece2b8b..3c40a8ec90e86 100644 --- a/www/src/pages/index.js +++ b/www/src/pages/index.js @@ -21,7 +21,6 @@ import TechWithIcon from "../components/tech-with-icon" class IndexRoute extends React.Component { render() { - console.log(this.props) const blogPosts = this.props.data.allMarkdownRemark return (
diff --git a/yarn.lock b/yarn.lock index 3e95b6abd2f33..6a716982398c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -229,13 +229,6 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -argparse@~0.1.15: - version "0.1.16" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-0.1.16.tgz#cfd01e0fbba3d6caed049fbd758d40f65196f57c" - dependencies: - underscore "~1.7.0" - underscore.string "~2.4.0" - aria-query@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.0.tgz#4af10a1e61573ddea0cf3b99b51c52c05b424d24" @@ -359,9 +352,9 @@ ast-types-flow@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" -ast-types@0.9.11: - version "0.9.11" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.11.tgz#371177bb59232ff5ceaa1d09ee5cad705b1a5aa9" +ast-types@0.9.12: + version "0.9.12" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.12.tgz#b136300d67026625ae15326982ca9918e5db73c9" async-each-series@^1.1.0: version "1.1.0" @@ -407,10 +400,6 @@ atob@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" -autolinker@~0.15.0: - version "0.15.3" - resolved "https://registry.yarnpkg.com/autolinker/-/autolinker-0.15.3.tgz#342417d8f2f3461b14cf09088d5edf8791dc9832" - autoprefixer@^6.0.2, autoprefixer@^6.3.1: version "6.7.7" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.7.7.tgz#1dbd1c835658e35ce3f9984099db00585c782014" @@ -434,7 +423,7 @@ aws4@^1.2.1, aws4@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -axios@^0.16.1, axios@^0.16.2: +axios@^0.16.1: version "0.16.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d" dependencies: @@ -1666,8 +1655,8 @@ boom@5.x.x: hoek "4.x.x" bowser@^1.7.3: - version "1.7.3" - resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.7.3.tgz#504bdb43118ca8db9cbbadf28fd60f265af96e4f" + version "1.8.0" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.8.0.tgz#889d46ac922ec5db8297672747362ef836781ba7" boxen@^0.6.0: version "0.6.0" @@ -1883,12 +1872,6 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" -bundle-loader@^0.5.4: - version "0.5.5" - resolved "https://registry.yarnpkg.com/bundle-loader/-/bundle-loader-0.5.5.tgz#11fd7b08edf86a1d708efcb1eca62ca51f6c368a" - dependencies: - loader-utils "^1.0.2" - byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" @@ -2000,8 +1983,8 @@ caniuse-api@^1.5.2, caniuse-api@^1.5.3: lodash.uniq "^4.5.0" caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: - version "1.0.30000744" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000744.tgz#00758ff7dd5f7138d34a15608dccf71a59656ffe" + version "1.0.30000746" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000746.tgz#501098c66f5fbbf634c02f25508b05e8809910f4" caniuse-lite@^1.0.30000718: version "1.0.30000744" @@ -2423,7 +2406,7 @@ colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" -colors@1.1.2, colors@^1.1.2, colors@~1.1.2: +colors@^1.1.2, colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" @@ -2535,7 +2518,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.10, concat-stream@^1.4.6, concat-stream@^1.4.7, concat-stream@^1.5.0, concat-stream@^1.5.2, concat-stream@^1.6.0: +concat-stream@^1.4.10, concat-stream@^1.4.6, concat-stream@^1.4.7, concat-stream@^1.5.0, concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -2853,7 +2836,7 @@ core-js@^1.0.0, core-js@^1.2.6: version "1.2.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" -core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0, core-js@^2.5.1: +core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0: version "2.5.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b" @@ -2997,8 +2980,8 @@ crypto-random-string@^1.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" css-color-function@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/css-color-function/-/css-color-function-1.3.2.tgz#4ba3e892fee9794644e6b0e1fd1df7811cd75502" + version "1.3.3" + resolved "https://registry.yarnpkg.com/css-color-function/-/css-color-function-1.3.3.tgz#8ed24c2c0205073339fafa004bc8c141fccb282e" dependencies: balanced-match "0.1.0" color "^0.11.0" @@ -3155,8 +3138,8 @@ cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": cssom "0.3.x" csvtojson@^1.1: - version "1.1.8" - resolved "https://registry.yarnpkg.com/csvtojson/-/csvtojson-1.1.8.tgz#e64e5e98e65fde7e6fd01436cb5de0ac7d1dda70" + version "1.1.9" + resolved "https://registry.yarnpkg.com/csvtojson/-/csvtojson-1.1.9.tgz#e641ae72f7bc2fa3f9aaf127e021fc89447c1cd1" dependencies: lodash "^4.17.3" strip-bom "1.0.0" @@ -3197,10 +3180,6 @@ date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" -dateformat@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.0.0.tgz#2743e3abb5c3fc2462e527dca445e04e9f4dee17" - dateformat@^1.0.11, dateformat@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.12.tgz#9f124b67594c937ff706932e4a642cca8dbbfee9" @@ -3216,13 +3195,13 @@ death@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" -debug@*, debug@^3.0.0, debug@^3.0.1, debug@^3.1.0: +debug@*, debug@^3.0.1, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" -debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9, debug@~2.6.4, debug@~2.6.6, debug@~2.6.7: +debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9, debug@~2.6.4, debug@~2.6.6, debug@~2.6.7, debug@~2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -3450,10 +3429,6 @@ detective@^4.0.0: acorn "^4.0.3" defined "^1.0.0" -diacritics-map@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/diacritics-map/-/diacritics-map-0.1.0.tgz#6dfc0ff9d01000a2edf2865371cac316e94977af" - diff@^1.3.2: version "1.4.0" resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" @@ -3730,7 +3705,11 @@ ejs@^2.4.1: version "2.5.7" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" -electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.18: +electron-to-chromium@^1.2.7: + version "1.3.26" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.26.tgz#996427294861a74d9c7c82b9260ea301e8c02d66" + +electron-to-chromium@^1.3.18: version "1.3.24" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.24.tgz#9b7b88bb05ceb9fa016a177833cc2dde388f21b6" @@ -3775,19 +3754,19 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: once "^1.4.0" engine.io-client@~3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-3.1.2.tgz#62a0ef08ec83d16a06668ccc3a4f37916768a6b9" + version "3.1.3" + resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-3.1.3.tgz#d705e48985dfe8b54a98c9f77052b8b08258be05" dependencies: component-emitter "1.2.1" component-inherit "0.0.3" - debug "~2.6.4" + debug "~2.6.9" engine.io-parser "~2.1.1" has-cors "1.1.0" indexof "0.0.1" parseqs "0.0.5" parseuri "0.0.5" ws "~2.3.1" - xmlhttprequest-ssl "1.5.3" + xmlhttprequest-ssl "~1.5.4" yeast "0.1.2" engine.io-parser@~2.1.0, engine.io-parser@~2.1.1: @@ -3801,13 +3780,13 @@ engine.io-parser@~2.1.0, engine.io-parser@~2.1.1: has-binary2 "~1.0.2" engine.io@~3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-3.1.2.tgz#00a3f6a4054bb1a07958074b1058764deedb7d8a" + version "3.1.3" + resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-3.1.3.tgz#7aecf71bf8a310f9fa21461999c4fcc035f8a877" dependencies: accepts "1.3.3" base64id "1.0.0" cookie "0.3.1" - debug "~2.6.4" + debug "~2.6.9" engine.io-parser "~2.1.0" ws "~2.3.1" optionalDependencies: @@ -3888,13 +3867,13 @@ es-to-primitive@^1.1.1: is-symbol "^1.0.1" es5-ext@^0.10.12, es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.30" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.30.tgz#7141a16836697dbabfaaaeee41495ce29f52c939" + version "0.10.31" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.31.tgz#7bb938c95a7f1b9f728092dc09c41edcc398eefe" dependencies: - es6-iterator "2" - es6-symbol "~3.1" + es6-iterator "~2.0.1" + es6-symbol "~3.1.1" -es6-iterator@2, es6-iterator@^2.0.1: +es6-iterator@^2.0.1, es6-iterator@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" dependencies: @@ -3910,7 +3889,7 @@ es6-promise@^4.0.5, es6-promise@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a" -es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1: +es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" dependencies: @@ -3981,8 +3960,8 @@ eslint-plugin-flow-vars@^0.5.0: resolved "https://registry.yarnpkg.com/eslint-plugin-flow-vars/-/eslint-plugin-flow-vars-0.5.0.tgz#a7fb78fd873c86e0e5839df3b3c90d47bc68c6d2" eslint-plugin-flowtype@^2.35.0: - version "2.39.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.39.0.tgz#40d14d8799717d3fc90658ceb6fc2b6cdf2a5531" + version "2.39.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.39.1.tgz#b5624622a0388bcd969f4351131232dcb9649cd5" dependencies: lodash "^4.15.0" @@ -4274,7 +4253,7 @@ express-graphql@^0.6.6: http-errors "^1.3.0" raw-body "^2.1.0" -express@^4.13.3, express@^4.14.0: +express@^4.13.3: version "4.16.1" resolved "https://registry.yarnpkg.com/express/-/express-4.16.1.tgz#6b33b560183c9b253b7b62144df33a4654ac9ed0" dependencies: @@ -4309,6 +4288,41 @@ express@^4.13.3, express@^4.14.0: utils-merge "1.0.1" vary "~1.1.2" +express@^4.14.0: + version "4.16.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.16.2.tgz#e35c6dfe2d64b7dca0a5cd4f21781be3299e076c" + dependencies: + accepts "~1.3.4" + array-flatten "1.1.1" + body-parser "1.18.2" + content-disposition "0.5.2" + content-type "~1.0.4" + cookie "0.3.1" + cookie-signature "1.0.6" + debug "2.6.9" + depd "~1.1.1" + encodeurl "~1.0.1" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.1.0" + fresh "0.5.2" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "~2.3.0" + parseurl "~1.3.2" + path-to-regexp "0.1.7" + proxy-addr "~2.0.2" + qs "6.5.1" + range-parser "~1.2.0" + safe-buffer "5.1.1" + send "0.16.1" + serve-static "1.13.1" + setprototypeof "1.1.0" + statuses "~1.3.1" + type-is "~1.6.15" + utils-merge "1.0.1" + vary "~1.1.2" + extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -4759,7 +4773,7 @@ fs-extra@2.0.0: graceful-fs "^4.1.2" jsonfile "^2.1.0" -fs-extra@^4.0.1, fs-extra@^4.0.2: +fs-extra@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.2.tgz#f91704c53d1b461f893452b0c307d9997647ab6b" dependencies: @@ -5549,7 +5563,7 @@ homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1: dependencies: parse-passwd "^1.0.0" -hosted-git-info@^2.1.4, hosted-git-info@^2.4.2, hosted-git-info@^2.5.0: +hosted-git-info@^2.1.4, hosted-git-info@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" @@ -5676,14 +5690,14 @@ ignore@^3.2.7, ignore@^3.3.3: version "3.3.5" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.5.tgz#c4e715455f6073a8d7e5dae72d2fc9d71663dba6" -image-size@^0.5.1, image-size@~0.5.0: - version "0.5.5" - resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" - image-size@^0.6.0: version "0.6.1" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.1.tgz#98122a562d59dcc097ef1b2c8191866eb8f5d663" +image-size@~0.5.0: + version "0.5.5" + resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" + imagemin-pngquant@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/imagemin-pngquant/-/imagemin-pngquant-5.0.1.tgz#d8a329da553afa226b11ce62debe0b7e37b439e6" @@ -6692,12 +6706,12 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" json2csv@^3.7: - version "3.11.2" - resolved "https://registry.yarnpkg.com/json2csv/-/json2csv-3.11.2.tgz#6a8166da343751ab4e8c31f843417bad44cc833f" + version "3.11.4" + resolved "https://registry.yarnpkg.com/json2csv/-/json2csv-3.11.4.tgz#51ad6aeb37f1f29b6d93e534f86f5d79ae0e2701" dependencies: cli-table "^0.3.1" commander "^2.8.1" - debug "^3.0.0" + debug "^3.1.0" flat "^4.0.0" lodash.clonedeep "^4.5.0" lodash.flatten "^4.4.0" @@ -7065,15 +7079,6 @@ linked-list@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/linked-list/-/linked-list-0.1.0.tgz#798b0ff97d1b92a4fd08480f55aea4e9d49d37bf" -list-item@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/list-item/-/list-item-1.1.1.tgz#0c65d00e287cb663ccb3cb3849a77e89ec268a56" - dependencies: - expand-range "^1.8.1" - extend-shallow "^2.0.1" - is-number "^2.1.0" - repeat-string "^1.5.2" - livereload-js@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/livereload-js/-/livereload-js-2.2.2.tgz#6c87257e648ab475bc24ea257457edcc1f8d0bc2" @@ -7543,31 +7548,10 @@ markdown-escapes@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.1.tgz#1994df2d3af4811de59a6714934c2b2292734518" -markdown-link@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/markdown-link/-/markdown-link-0.1.1.tgz#32c5c65199a6457316322d1e4229d13407c8c7cf" - markdown-table@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.1.tgz#4b3dd3a133d1518b8ef0dbc709bf2a1b4824bc8c" -markdown-toc@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/markdown-toc/-/markdown-toc-1.2.0.tgz#44a15606844490314afc0444483f9e7b1122c339" - dependencies: - concat-stream "^1.5.2" - diacritics-map "^0.1.0" - gray-matter "^2.1.0" - lazy-cache "^2.0.2" - list-item "^1.1.1" - markdown-link "^0.1.1" - minimist "^1.2.0" - mixin-deep "^1.1.3" - object.pick "^1.2.0" - remarkable "^1.7.1" - repeat-string "^1.6.1" - strip-color "^0.1.0" - match-at@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/match-at/-/match-at-0.1.1.tgz#25d040d291777704d5e6556bbb79230ec2de0540" @@ -7627,8 +7611,8 @@ mdast-util-inject@^1.1.0: mdast-util-to-string "^1.0.0" mdast-util-to-hast@^2.1.1, mdast-util-to-hast@^2.4.0: - version "2.4.3" - resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-2.4.3.tgz#cd7874c9832627f134fd3756163873f93f2b1de3" + version "2.5.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-2.5.0.tgz#f087844d255c7540f36906da30ba106c0ee5ee2f" dependencies: collapse-white-space "^1.0.0" detab "^2.0.0" @@ -7863,7 +7847,7 @@ mitt@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/mitt/-/mitt-1.1.2.tgz#380e61480d6a615b660f07abb60d51e0a4e4bed6" -mixin-deep@^1.1.3, mixin-deep@^1.2.0: +mixin-deep@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.2.0.tgz#d02b8c6f8b6d4b8f5982d3fd009c4919851c3fe2" dependencies: @@ -7912,23 +7896,27 @@ module-deps-sortable@4.0.6: through2 "^2.0.0" xtend "^4.0.0" -moment@2.x.x, moment@^2.16.0, moment@^2.6.0: +moment@2.x.x, moment@^2.6.0: version "2.18.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f" -mongodb-core@2.1.15: - version "2.1.15" - resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.15.tgz#841f53b87ffff4c7458189c35c8ae827e1169764" +moment@^2.16.0: + version "2.19.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.1.tgz#56da1a2d1cbf01d38b7e1afc31c10bcfa1929167" + +mongodb-core@2.1.16: + version "2.1.16" + resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.16.tgz#5dc20a48b1f0a2515fd57daaea2c4853467454e0" dependencies: bson "~1.0.4" require_optional "~1.0.0" mongodb@^2.2.30: - version "2.2.31" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.31.tgz#1940445c661e19217bb3bf8245d9854aaef548db" + version "2.2.32" + resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.32.tgz#620eaaa1995fb457c4ef7054e5f560257a697e58" dependencies: es6-promise "3.2.1" - mongodb-core "2.1.15" + mongodb-core "2.1.16" readable-stream "2.2.7" ms@2.0.0, ms@^2.0.0: @@ -9564,7 +9552,7 @@ promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.8, prop-types@^15.6.0: +prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.8: version "15.6.0" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856" dependencies: @@ -9722,13 +9710,13 @@ rc@^1.0.1, rc@^1.1.2, rc@^1.1.6, rc@^1.1.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-deep-force-update@^2.0.1: +react-deep-force-update@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-2.1.1.tgz#8ea4263cd6455a050b37445b3f08fd839d86e909" react-docgen@^2.15.0: - version "2.18.0" - resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-2.18.0.tgz#fe6c57bd10fe2f3ecb32ab800a2db0fb43a93a35" + version "2.19.0" + resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-2.19.0.tgz#a9e356277aa31f42df163f0b4917d3b077985f9d" dependencies: async "^2.1.4" babel-runtime "^6.9.2" @@ -9747,15 +9735,6 @@ react-dom@^15.6.0: object-assign "^4.1.0" prop-types "^15.5.10" -react-dom@^16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.0.0.tgz#9cc3079c3dcd70d4c6e01b84aab2a7e34c303f58" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.0" - react-helmet@^5.1.3: version "5.2.0" resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-5.2.0.tgz#a81811df21313a6d55c5f058c4aeba5d6f3d97a7" @@ -9766,15 +9745,15 @@ react-helmet@^5.1.3: react-side-effect "^1.1.0" react-hot-loader@^3.0.0-beta.6: - version "3.0.0-beta.7" - resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-3.0.0-beta.7.tgz#d5847b8165d731c4d5b30d86d5d4716227a0fa83" + version "3.0.0" + resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-3.0.0.tgz#6e28da9d459da8085f5ee8bdd775046ba4b5cd0b" dependencies: babel-template "^6.7.0" global "^4.3.0" - react-deep-force-update "^2.0.1" + react-deep-force-update "^2.1.1" react-proxy "^3.0.0-alpha.0" redbox-react "^1.3.6" - source-map "^0.4.4" + source-map "^0.6.1" react-jss@^7.0.2: version "7.2.0" @@ -9792,7 +9771,7 @@ react-proxy@^3.0.0-alpha.0: dependencies: lodash "^4.6.1" -react-router-dom@^4.1.1, react-router-dom@^4.2.2: +react-router-dom@^4.1.1: version "4.2.2" resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.2.2.tgz#c8a81df3adc58bba8a76782e946cbd4eae649b8d" dependencies: @@ -9836,15 +9815,6 @@ react@^15.5.4, react@^15.6.0: object-assign "^4.1.0" prop-types "^15.5.10" -react@^16.0.0: - version "16.0.0" - resolved "https://registry.yarnpkg.com/react/-/react-16.0.0.tgz#ce7df8f1941b036f02b2cca9dbd0cb1f0e855e2d" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.0" - read-all-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" @@ -9983,14 +9953,14 @@ readdirp@^2.0.0: set-immediate-shim "^1.0.1" recast@^0.12.6: - version "0.12.6" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.12.6.tgz#4b0fb82feb1d10b3bd62d34943426d9b3ed30d4c" + version "0.12.7" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.12.7.tgz#6ec2ba1ae1d163cd12b5c17c3823458b299f3a0b" dependencies: - ast-types "0.9.11" + ast-types "0.9.12" core-js "^2.4.1" esprima "~4.0.0" private "~0.1.5" - source-map "~0.5.0" + source-map "~0.6.1" rechoir@^0.6.2: version "0.6.2" @@ -10277,13 +10247,6 @@ remark@^8.0.0: remark-stringify "^4.0.0" unified "^6.0.0" -remarkable@^1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/remarkable/-/remarkable-1.7.1.tgz#aaca4972100b66a642a63a1021ca4bac1be3bff6" - dependencies: - argparse "~0.1.15" - autolinker "~0.15.0" - remote-origin-url@0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/remote-origin-url/-/remote-origin-url-0.4.0.tgz#4d3e2902f34e2d37d1c263d87710b77eb4086a30" @@ -11186,11 +11149,11 @@ sockjs-client@^1.0.3: url-parse "^1.1.8" sockjs@^0.3.15: - version "0.3.18" - resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.18.tgz#d9b289316ca7df77595ef299e075f0f937eb4207" + version "0.3.19" + resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.19.tgz#d976bbe800af7bd20ae08598d582393508993c0d" dependencies: faye-websocket "^0.10.0" - uuid "^2.0.2" + uuid "^3.0.1" sort-keys@^1.0.0, sort-keys@^1.1.1: version "1.1.2" @@ -11259,11 +11222,11 @@ source-map@^0.4.2, source-map@^0.4.4, source-map@~0.4.1: dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3, source-map@~0.5.6: +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, source-map@~0.5.3, source-map@~0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" -source-map@^0.6.1: +source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" @@ -11583,10 +11546,6 @@ strip-bom@^2.0.0: dependencies: is-utf8 "^0.2.0" -strip-color@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/strip-color/-/strip-color-0.1.0.tgz#106f65d3d3e6a2d9401cac0eb0ce8b8a702b4f7b" - strip-dirs@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-1.1.1.tgz#960bbd1287844f3975a4558aa103a8255e2456a0" @@ -11700,8 +11659,8 @@ stylis@3.2.18: resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.2.18.tgz#211661f13b636e9e451456a1aadcec31248edf0e" stylis@^3.2.1: - version "3.2.20" - resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.2.20.tgz#f4511b1ef825442cd7d965da30f37084151e9f7b" + version "3.3.2" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.3.2.tgz#95ef285836e98243f8b8f64a9a72706ea6c893ea" stylus-loader@webpack1: version "2.5.1" @@ -12037,10 +11996,6 @@ tiny-lr@^1.0.3: object-assign "^4.1.0" qs "^6.4.0" -tinytim@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/tinytim/-/tinytim-0.1.1.tgz#c968a1e5559ad9553224ef7627bab34e3caef8a8" - title-case@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/title-case/-/title-case-2.1.1.tgz#3e127216da58d2bc5becf137ab91dae3a7cd8faa" @@ -12129,14 +12084,6 @@ tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" -tracer@^0.8.9: - version "0.8.11" - resolved "https://registry.yarnpkg.com/tracer/-/tracer-0.8.11.tgz#5941c67404410d86665b75bba68bb1c9d2c3cacd" - dependencies: - colors "1.1.2" - dateformat "2.0.0" - tinytim "0.1.1" - traceur@0.0.105: version "0.0.105" resolved "https://registry.yarnpkg.com/traceur/-/traceur-0.0.105.tgz#5cf9dee83d6b77861c3d6c44d53859aed7ab0479" @@ -12195,8 +12142,8 @@ ts-loader@^2.0.3: semver "^5.0.1" tslib@^1.6.0: - version "1.7.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" + version "1.8.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6" tty-browserify@0.0.0: version "0.0.0" @@ -12306,18 +12253,10 @@ underscore.string@^3.3.4: sprintf-js "^1.0.3" util-deprecate "^1.0.2" -underscore.string@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-2.4.0.tgz#8cdd8fbac4e2d2ea1e7e2e8097c42f442280f85b" - underscore@^1.7.0: version "1.8.3" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022" -underscore@~1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209" - unherit@^1.0.4: version "1.1.0" resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.0.tgz#6b9aaedfbf73df1756ad9e316dd981885840cd7d" @@ -12587,7 +12526,7 @@ uuid@3.1.0, uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" -uuid@^2.0.1, uuid@^2.0.2: +uuid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" @@ -13152,9 +13091,9 @@ xml@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" -xmlhttprequest-ssl@1.5.3: - version "1.5.3" - resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz#185a888c04eca46c3e4070d99f7b49de3528992d" +xmlhttprequest-ssl@~1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.4.tgz#04f560915724b389088715cc0ed7813e9677bf57" "xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" @@ -13217,7 +13156,7 @@ yargs@4.7.1: y18n "^3.2.1" yargs-parser "^2.4.0" -yargs@8.0.2, yargs@^8.0.1, yargs@^8.0.2: +yargs@8.0.2, yargs@^8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" dependencies: @@ -13310,9 +13249,9 @@ yeast@0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" -yurnalist@^0.1.10: - version "0.1.10" - resolved "https://registry.yarnpkg.com/yurnalist/-/yurnalist-0.1.10.tgz#a0ba9a4bdb272e2313775cf20552b81902bfe649" +yurnalist@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/yurnalist/-/yurnalist-0.2.1.tgz#2d32b9618ab6491891c131bd90a5295e19fd4bad" dependencies: chalk "^1.1.1" death "^1.0.0" @@ -13324,8 +13263,6 @@ yurnalist@^0.1.10: is-ci "^1.0.10" leven "^2.0.0" loud-rejection "^1.2.0" - markdown-toc "^1.1.0" - minimatch "^3.0.3" node-emoji "^1.0.4" object-path "^0.11.2" read "^1.0.7"