-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable storybook to deliver statics from hapijs server
- Loading branch information
1 parent
10b0af7
commit 68054a3
Showing
6 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
# Storybook | ||
|
||
The boilerplate comes along with a fully functional storybook to present components | ||
The boilerplate comes along with a [storybook][1] to present components | ||
in an isolated (and mocked) environment to other developers and your clients. | ||
|
||
## Start Storybook | ||
|
||
Running storybook not only requires to exectute `npm run storybook` but also | ||
`npm run start:server`. Or if you want to enter the watch mode of the | ||
server and client fields (including statics): `npm run watch:server` together | ||
with `npm run watch:client`. We recommend to run storybook together with the | ||
watch mode of the client and server. | ||
|
||
## Static files | ||
|
||
The storybook is able to deliver static files, because we implemented a solution | ||
in [middleware.js](./middleware.js). The solution is based on [indiesquidge's | ||
solution](https://github.com/storybooks/storybook/issues/208#issuecomment-306953718). | ||
|
||
## Available features and toolset | ||
|
||
* [Apollo Client and GQL Endpoint Mocking](./gql/README.md) | ||
* [Mocked Redux Store](./redux/README.md) | ||
|
||
[1]: https://github.com/storybooks/storybook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Inspired by (Credits): | ||
* - https://github.com/storybooks/storybook/issues/208#issuecomment-306953718 | ||
* | ||
* Other links | ||
* - https://github.com/storybooks/storybook/issues/1685#issuecomment-336811882 | ||
* - https://github.com/storybooks/storybook/issues/714#issuecomment-302996551 | ||
* - https://github.com/storybooks/storybook/pull/435#issuecomment-264813688 | ||
*/ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const proxy = require('http-proxy-middleware') | ||
|
||
require('dotenv').config() | ||
|
||
const host = process.env.HOST || 'localhost' | ||
const port = process.env.PORT || 8000 | ||
|
||
// proxy static request to our Node.js server | ||
module.exports = function expressMiddleware(router) { | ||
router.use( | ||
'/__static__', | ||
proxy({ | ||
changeOrigin: true, | ||
target: `http://${host}:${port}/`, | ||
}), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4502,6 +4502,10 @@ event-stream@~3.3.0: | |
stream-combiner "~0.0.4" | ||
through "~2.3.1" | ||
|
||
eventemitter3@^3.0.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" | ||
|
||
events@^1.0.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" | ||
|
@@ -4930,6 +4934,12 @@ flush-write-stream@^1.0.0: | |
inherits "^2.0.1" | ||
readable-stream "^2.0.4" | ||
|
||
follow-redirects@^1.0.0: | ||
version "1.5.5" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.5.tgz#3c143ca599a2e22e62876687d68b23d55bad788b" | ||
dependencies: | ||
debug "^3.1.0" | ||
|
||
for-in@^0.1.3: | ||
version "0.1.8" | ||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1" | ||
|
@@ -5765,6 +5775,23 @@ http-parser-js@>=0.4.0: | |
version "0.4.13" | ||
resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.13.tgz#3bd6d6fde6e3172c9334c3b33b6c193d80fe1137" | ||
|
||
[email protected]: | ||
version "0.18.0" | ||
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz#0987e6bb5a5606e5a69168d8f967a87f15dd8aab" | ||
dependencies: | ||
http-proxy "^1.16.2" | ||
is-glob "^4.0.0" | ||
lodash "^4.17.5" | ||
micromatch "^3.1.9" | ||
|
||
http-proxy@^1.16.2: | ||
version "1.17.0" | ||
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.17.0.tgz#7ad38494658f84605e2f6db4436df410f4e5be9a" | ||
dependencies: | ||
eventemitter3 "^3.0.0" | ||
follow-redirects "^1.0.0" | ||
requires-port "^1.0.0" | ||
|
||
http-signature@~1.1.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" | ||
|
@@ -7738,7 +7765,7 @@ micromatch@^2.1.5, micromatch@^2.3.11, micromatch@^2.3.7: | |
parse-glob "^3.0.4" | ||
regex-cache "^0.4.2" | ||
|
||
micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: | ||
micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8, micromatch@^3.1.9: | ||
version "3.1.10" | ||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" | ||
dependencies: | ||
|