From f007889283c72470b2396fa6328b56aea81793d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 9 May 2018 10:34:49 +0100 Subject: [PATCH] fix: try to serve a static route before maping assets --- consoles/my-joy-images/lib/index.js | 24 +++++++++---------- consoles/my-joy-instances/lib/index.js | 24 +++++++++---------- consoles/my-joy-navigation/lib/index.js | 24 +++++++++---------- packages/ui-toolkit/src/styleguide/wrapper.js | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/consoles/my-joy-images/lib/index.js b/consoles/my-joy-images/lib/index.js index 643b2c00..75c7af75 100644 --- a/consoles/my-joy-images/lib/index.js +++ b/consoles/my-joy-images/lib/index.js @@ -84,24 +84,24 @@ exports.register = async server => { }); } + const buildPathname = Path.join(buildStatic, 'static', rest); + const [err2] = await Intercept( + Fs.access(buildPathname, Fs.constants.R_OK) + ); + + if (!err2) { + return h.file(buildPathname, { + confine: buildStatic + }); + } + const filename = manifest[rest]; if (!filename) { return Boom.notFound(); } const buildMapPathname = Path.join(buildRoot, filename); - const [err2] = await Intercept( - Fs.access(buildMapPathname, Fs.constants.R_OK) - ); - - if (!err2) { - return h.file(buildMapPathname, { - confine: buildStatic - }); - } - - const buildPathname = Path.join(buildStatic, rest); - return h.file(buildPathname, { + return h.file(buildMapPathname, { confine: buildStatic }); } diff --git a/consoles/my-joy-instances/lib/index.js b/consoles/my-joy-instances/lib/index.js index 6764a95a..66f99716 100644 --- a/consoles/my-joy-instances/lib/index.js +++ b/consoles/my-joy-instances/lib/index.js @@ -84,24 +84,24 @@ exports.register = async server => { }); } + const buildPathname = Path.join(buildStatic, 'static', rest); + const [err2] = await Intercept( + Fs.access(buildPathname, Fs.constants.R_OK) + ); + + if (!err2) { + return h.file(buildPathname, { + confine: buildStatic + }); + } + const filename = manifest[rest]; if (!filename) { return Boom.notFound(); } const buildMapPathname = Path.join(buildRoot, filename); - const [err2] = await Intercept( - Fs.access(buildMapPathname, Fs.constants.R_OK) - ); - - if (!err2) { - return h.file(buildMapPathname, { - confine: buildStatic - }); - } - - const buildPathname = Path.join(buildStatic, rest); - return h.file(buildPathname, { + return h.file(buildMapPathname, { confine: buildStatic }); } diff --git a/consoles/my-joy-navigation/lib/index.js b/consoles/my-joy-navigation/lib/index.js index bee77337..6b1a07f4 100644 --- a/consoles/my-joy-navigation/lib/index.js +++ b/consoles/my-joy-navigation/lib/index.js @@ -79,24 +79,24 @@ exports.register = async server => { }); } + const buildPathname = Path.join(buildStatic, 'static', rest); + const [err2] = await Intercept( + Fs.access(buildPathname, Fs.constants.R_OK) + ); + + if (!err2) { + return h.file(buildPathname, { + confine: buildStatic + }); + } + const filename = manifest[rest]; if (!filename) { return Boom.notFound(); } const buildMapPathname = Path.join(buildRoot, filename); - const [err2] = await Intercept( - Fs.access(buildMapPathname, Fs.constants.R_OK) - ); - - if (!err2) { - return h.file(buildMapPathname, { - confine: buildStatic - }); - } - - const buildPathname = Path.join(buildStatic, rest); - return h.file(buildPathname, { + return h.file(buildMapPathname, { confine: buildStatic }); } diff --git a/packages/ui-toolkit/src/styleguide/wrapper.js b/packages/ui-toolkit/src/styleguide/wrapper.js index c0125b57..e61e97d7 100644 --- a/packages/ui-toolkit/src/styleguide/wrapper.js +++ b/packages/ui-toolkit/src/styleguide/wrapper.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ThemeProvider, injectGlobal } from 'styled-components'; +import styled, { ThemeProvider, injectGlobal } from 'styled-components'; import theme from '../theme'; import Base from '../base';