From c1bfd74b650f718fe802117f05f9026410e54f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Poduszl=C3=B3?= Date: Sat, 20 Jan 2018 18:48:44 +0100 Subject: [PATCH] Fix copying "dev-404-page.js" to the cache folder on Windows (#3627) * Fix images disappearing from rendered markdown files Fixes #3608 * Revert invalid indentation changes * Fix copying "dev-404-page.js" to the cache folder on Windows Fixes #2819 * Fix snapshot tests * Revert invalid improper snapshot test modification --- .../__snapshots__/load-plugins.js.snap | 48 +++++++++---------- packages/gatsby/src/bootstrap/load-plugins.js | 6 +-- .../dev-404-page/gatsby-node.js | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/gatsby/src/bootstrap/__tests__/__snapshots__/load-plugins.js.snap b/packages/gatsby/src/bootstrap/__tests__/__snapshots__/load-plugins.js.snap index 2602486084c00..5b87a2422b84b 100644 --- a/packages/gatsby/src/bootstrap/__tests__/__snapshots__/load-plugins.js.snap +++ b/packages/gatsby/src/bootstrap/__tests__/__snapshots__/load-plugins.js.snap @@ -2,6 +2,18 @@ exports[`Load plugins Loads plugins defined with an object but without an option key 1`] = ` Array [ + Object { + "id": "Plugin dev-404-page", + "name": "dev-404-page", + "nodeAPIs": Array [ + "createPages", + ], + "pluginOptions": Object { + "plugins": Array [], + }, + "resolve": "", + "version": "1.0.0", + }, Object { "id": "Plugin component-page-creator", "name": "component-page-creator", @@ -39,18 +51,6 @@ Array [ "resolve": "", "version": "1.0.0", }, - Object { - "id": "Plugin dev-404-page", - "name": "dev-404-page", - "nodeAPIs": Array [ - "createPages", - ], - "pluginOptions": Object { - "plugins": Array [], - }, - "resolve": "", - "version": "1.0.0", - }, Object { "id": "Plugin prod-404", "name": "prod-404", @@ -99,6 +99,18 @@ Array [ exports[`Load plugins load plugins for a site 1`] = ` Array [ + Object { + "id": "Plugin dev-404-page", + "name": "dev-404-page", + "nodeAPIs": Array [ + "createPages", + ], + "pluginOptions": Object { + "plugins": Array [], + }, + "resolve": "", + "version": "1.0.0", + }, Object { "id": "Plugin component-page-creator", "name": "component-page-creator", @@ -136,18 +148,6 @@ Array [ "resolve": "", "version": "1.0.0", }, - Object { - "id": "Plugin dev-404-page", - "name": "dev-404-page", - "nodeAPIs": Array [ - "createPages", - ], - "pluginOptions": Object { - "plugins": Array [], - }, - "resolve": "", - "version": "1.0.0", - }, Object { "id": "Plugin prod-404", "name": "prod-404", diff --git a/packages/gatsby/src/bootstrap/load-plugins.js b/packages/gatsby/src/bootstrap/load-plugins.js index b0ba05cbf0681..47331eef13114 100644 --- a/packages/gatsby/src/bootstrap/load-plugins.js +++ b/packages/gatsby/src/bootstrap/load-plugins.js @@ -133,6 +133,9 @@ module.exports = async (config = {}) => { } // Add internal plugins + plugins.push( + processPlugin(path.join(__dirname, `../internal-plugins/dev-404-page`)) + ) plugins.push( processPlugin( path.join(__dirname, `../internal-plugins/component-page-creator`) @@ -148,9 +151,6 @@ module.exports = async (config = {}) => { path.join(__dirname, `../internal-plugins/internal-data-bridge`) ) ) - plugins.push( - processPlugin(path.join(__dirname, `../internal-plugins/dev-404-page`)) - ) plugins.push( processPlugin(path.join(__dirname, `../internal-plugins/prod-404`)) ) diff --git a/packages/gatsby/src/internal-plugins/dev-404-page/gatsby-node.js b/packages/gatsby/src/internal-plugins/dev-404-page/gatsby-node.js index 45a2bc0c20a00..8540086d2d3ca 100644 --- a/packages/gatsby/src/internal-plugins/dev-404-page/gatsby-node.js +++ b/packages/gatsby/src/internal-plugins/dev-404-page/gatsby-node.js @@ -8,7 +8,7 @@ exports.createPages = async ({ store, boundActionCreators }) => { const currentPath = path.join(__dirname, `./raw_dev-404-page.js`) const newPath = path.join(program.directory, `.cache`, `dev-404-page.js`) - fs.copySync(currentPath, newPath) + await fs.copy(currentPath, newPath) createPage({ component: newPath,