Skip to content

Commit

Permalink
chore: fix storybook config
Browse files Browse the repository at this point in the history
  • Loading branch information
casserni authored and P0lip committed May 17, 2019
1 parent b7fecc2 commit 96eb511
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 61 deletions.
8 changes: 7 additions & 1 deletion .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
import '@stoplight/storybook-config/addons';
require('@storybook/addon-knobs/register');

require('@storybook/addon-actions/register');

require('@storybook/addon-links/register');

require('@storybook/addon-options/register');
32 changes: 31 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
import '@stoplight/storybook-config/config';
import * as React from 'react';
import { withOptions } from '@storybook/addon-options';
import { addDecorator, configure } from '@storybook/react';

import '@stoplight/tree-list/styles/_tree-list.scss';
import '@stoplight/ui-kit/styles/_ui-kit.scss';
import { ThemeContainer } from '@stoplight/ui-kit';

addDecorator(
withOptions({
name: 'Stoplight Json Schema Viewer',
url: 'https://github.com/stoplightio/json-schema-viewer',
goFullScreen: false,
showStoriesPanel: true,
showAddonPanel: true,
showSearchBox: false,
addonPanelInRight: true,
sortStoriesByKind: true,
hierarchySeparator: /\//,
hierarchyRootSeparator: /:/,
selectedAddonPanel: undefined,
}),
);

function loadStories() {
require('@project/stories');
}

addDecorator(story => <ThemeContainer>{story()}</ThemeContainer>);

configure(loadStories, module);
20 changes: 12 additions & 8 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<!--NEED TO SET BODY FONT SIZE TO UI-KIT BASE SINCE WE USE REMS -->
<style>
html {
font-family: aktiv-grotesk, -apple-system, BlinkMacSystemFont, Roboto, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}
html, body {
padding: 0;
margin: 0;
}
html,
body {
padding: 0;
margin: 0;

font-size: 14px;
}

#root {
height: 100%;
}
</style>
14 changes: 0 additions & 14 deletions .storybook/theme.js

This file was deleted.

61 changes: 57 additions & 4 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,62 @@
const defaultConfig = require('@stoplight/storybook-config/webpack.config');
const path = require('path');
const PackageImporter = require('node-sass-package-importer');

module.exports = (baseConfig, env, config) => {
config = defaultConfig(baseConfig, env, config);
const cwd = process.cwd();

// ... further customize if needed
module.exports = ({ config }) => {
config.context = cwd;
config.mode = 'development';

config.resolve.alias['@project/stories'] = require.resolve('src/__stories__/index.ts', { paths: [cwd] });
config.resolve.extensions.push('.ts', '.tsx', '.js');
config.resolve.modules = [...(config.resolve.modules || []), path.resolve('./')];

config.module.rules.push({
test: /\.(ts|tsx)$/,
include: [path.resolve(cwd, 'src')],
use: [
{
loader: require.resolve('ts-loader'),
options: {
onlyCompileBundledFiles: true, // https://github.com/TypeStrong/ts-loader#onlycompilebundledfiles-boolean-defaultfalse
},
},
],
});

config.module.rules.push({
test: /\.scss$/,
use: [
{
loader: 'style-loader',
options: {
sourceMap: true,
},
},
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
ident: 'postcss',
plugins: loader => [require('postcss-import'), require('autoprefixer')],
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
importer: [PackageImporter()],
},
},
],
include: path.resolve(__dirname, '../'),
});

return config;
};
148 changes: 115 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2412,6 +2412,17 @@
core-js "^2.6.5"
util-deprecate "^1.0.2"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.0.10.tgz#8911e6e7797185327f0117035a4bc451a57e62d7"
integrity sha512-plpLh17dt8KWhs8dRQlleClc7sibE1Plq7QQWyAsZjblRHfpNnv82Ax9ArmMeGFx2TRTTbCOcw9PiaKkt5/E7Q==
dependencies:
"@storybook/channels" "5.0.10"
"@storybook/client-logger" "5.0.10"
core-js "^2.6.5"
global "^4.3.2"
util-deprecate "^1.0.2"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.0.3.tgz#073352021d97ebbd3b8499e1dbe7fe32eafaaa28"
Expand All @@ -2434,6 +2445,13 @@
global "^4.3.2"
telejson "^2.1.0"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.0.10.tgz#b1ae31784359a3d12403a53a5be8eb2327c4a467"
integrity sha512-5WWSHEI6uFkzv3E5UaqMH2H0BFCI1CyPrJRUZyhsrBcnJctUQ+4J74IMCP9FQhaBCc6yLQlKWLpllaIHB5kPbA==
dependencies:
core-js "^2.6.5"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.0.3.tgz#ab1623b2dc6ab9202f7938bf2210b00259794784"
Expand All @@ -2460,13 +2478,51 @@
memoizerific "^1.11.3"
qs "^6.5.2"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.0.10.tgz#710b249c30aa320a0aef7da464d7e621a390bf92"
integrity sha512-Nh4dJ8rTPtOT1/Bef39+4HZVYX6EJthMpjjV04AWxT5ngxBa2MzhmcbnoYc3NOBSRh9fhJ6jm14/skQmLAO/jQ==
dependencies:
core-js "^2.6.5"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.0.3.tgz#5ec45b3173313aa7912ac95ac1ec530598a9d20e"
integrity sha512-1izIxCV1QsYfz5c93sUlHI6IlkVF3Rslje0QQeGOQPHZ4Pe73JzUjIlMKww9BAYS7rYbq7asNNplEp4GIgIdYQ==
dependencies:
core-js "^2.6.5"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.0.10.tgz#e0e7eed0e42160a8143fb7e57e7b45bb1ed71841"
integrity sha512-G2+2+8y3vFBvOqbaqOLDAjWFM9iO3TNnWadqkS5t6jAsl/pCVozKecPihR8S7Qr4Joy3PpdVSXGjFNFDWVJT4g==
dependencies:
"@storybook/addons" "5.0.10"
"@storybook/client-logger" "5.0.10"
"@storybook/core-events" "5.0.10"
"@storybook/router" "5.0.10"
"@storybook/theming" "5.0.10"
core-js "^2.6.5"
global "^4.3.2"
immer "^1.12.0"
js-beautify "^1.8.9"
lodash.pick "^4.4.0"
lodash.throttle "^4.1.1"
memoizerific "^1.11.3"
polished "^2.3.3"
prop-types "^15.6.2"
react "^16.8.1"
react-dom "^16.8.1"
react-focus-lock "^1.17.7"
react-helmet-async "^0.2.0"
react-inspector "^2.3.0"
react-popper-tooltip "^2.8.0"
react-syntax-highlighter "^8.0.1"
react-textarea-autosize "^7.0.4"
reactjs-popup "^1.3.2"
recompose "^0.30.0"
render-fragment "^0.1.1"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.0.3.tgz#99df80256ce19d5d6d307b4f2a8d2f2a03c68b5a"
Expand Down Expand Up @@ -2498,6 +2554,13 @@
recompose "^0.30.0"
render-fragment "^0.1.1"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.0.10.tgz#6437f8b6a6c3c902fa2fbad8de992c5104115332"
integrity sha512-Hp8PleSXAbVNr/yi58JIQb/tjZVpRcjEe8ztIp4JT5qhpz+xHTiVnS7mo8gCdyMw5cr38ANgdlZGnLshJY29lQ==
dependencies:
core-js "^2.6.5"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.0.3.tgz#1b9d6265f7a2b16a0ddee274975e104d7a02c9f6"
Expand Down Expand Up @@ -2616,6 +2679,18 @@
semver "^5.6.0"
webpack "^4.29.0"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.0.10.tgz#a756dc521fc4df19a090fcc23eed0a5de5fedc87"
integrity sha512-mHxMynnsbUNcr1GoXXunRVI+JvDTBE/lAAdqzMUduI4E6eUv8MHXw2KfeNQcZaNAf0PLynvbqJd2qpfMpKo/zA==
dependencies:
"@reach/router" "^1.2.1"
"@storybook/theming" "5.0.10"
core-js "^2.6.5"
global "^4.3.2"
memoizerific "^1.11.3"
qs "^6.5.2"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.0.3.tgz#8af21da49c2801931b54810b74118f144b0a863e"
Expand All @@ -2628,6 +2703,26 @@
memoizerific "^1.11.3"
qs "^6.5.2"

"@storybook/[email protected]":
version "5.0.10"
resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.0.10.tgz#6e2b00f879678419e2297ed8a31c357ae7976801"
integrity sha512-4IUtWglyAQCPHKMqPZkTWc/8FbfGHwtRSbaNxbv5S6PEcfWPIiMVWWRYMBNyETvYoYbCOHORH1w7iwJs75sRmA==
dependencies:
"@emotion/core" "^10.0.7"
"@emotion/styled" "^10.0.7"
"@storybook/client-logger" "5.0.10"
common-tags "^1.8.0"
core-js "^2.6.5"
deep-object-diff "^1.1.0"
emotion-theming "^10.0.7"
global "^4.3.2"
lodash.isequal "^4.5.0"
lodash.mergewith "^4.6.1"
memoizerific "^1.11.3"
polished "^2.3.3"
prop-types "^15.6.2"
react-inspector "^2.3.1"

"@storybook/[email protected]":
version "5.0.3"
resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.0.3.tgz#d4dbf8016bc03b8581edaa5e3ace145d5e9dd504"
Expand Down Expand Up @@ -3791,14 +3886,14 @@ [email protected]:
util.promisify "^1.0.0"

[email protected]:
version "8.0.4"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.4.tgz#7bbf20cbe4560629e2e41534147692d3fecbdce6"
integrity sha512-fhBhNkUToJcW9nV46v8w87AJOwAJDz84c1CL57n3Stj73FANM/b9TbCUK4YhdOwEyZ+OxhYpdeZDNzSI29Firw==
version "8.0.6"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb"
integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw==
dependencies:
find-cache-dir "^1.0.0"
find-cache-dir "^2.0.0"
loader-utils "^1.0.2"
mkdirp "^0.5.1"
util.promisify "^1.0.0"
pify "^4.0.1"

babel-messages@^6.23.0:
version "6.23.0"
Expand Down Expand Up @@ -6978,15 +7073,6 @@ [email protected]:
statuses "~1.4.0"
unpipe "~1.0.0"

find-cache-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f"
integrity sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=
dependencies:
commondir "^1.0.1"
make-dir "^1.0.0"
pkg-dir "^2.0.0"

find-cache-dir@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d"
Expand Down Expand Up @@ -10636,9 +10722,9 @@ [email protected], mute-stream@~0.0.4:
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=

nan@^2.13.2:
version "2.14.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==
version "2.13.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7"
integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==

nan@^2.9.2:
version "2.12.1"
Expand Down Expand Up @@ -11859,6 +11945,11 @@ pify@^3.0.0:
resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"
integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=

pify@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==

pinkie-promise@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa"
Expand Down Expand Up @@ -12040,16 +12131,7 @@ postcss@^7.0.0, postcss@^7.0.6:
source-map "^0.6.1"
supports-color "^5.5.0"

postcss@^7.0.1:
version "7.0.16"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.16.tgz#48f64f1b4b558cb8b52c88987724359acb010da2"
integrity sha512-MOo8zNSlIqh22Uaa3drkdIAgUGEL+AD1ESiSdmElLUmE2uVDo1QloiT/IfW9qRw8Gw+Y/w69UVMGwbufMSftxA==
dependencies:
chalk "^2.4.2"
source-map "^0.6.1"
supports-color "^6.1.0"

postcss@^7.0.14, postcss@^7.0.5:
postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.5:
version "7.0.14"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.14.tgz#4527ed6b1ca0d82c53ce5ec1a2041c2346bbd6e5"
integrity sha512-NsbD6XUUMZvBxtQAJuWDJeeC4QFsmWsfozWxCJPWf3M55K9iu2iMDaKqyoOdTJ1R4usBXuxlVFAIo8rZPQD4Bg==
Expand Down Expand Up @@ -13440,9 +13522,9 @@ [email protected], resolve@^1.1.6, resolve@^1.3.2, resolve@^1.8.1:
path-parse "^1.0.6"

resolve@^1.1.7:
version "1.11.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232"
integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==
version "1.10.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18"
integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA==
dependencies:
path-parse "^1.0.6"

Expand Down Expand Up @@ -15002,9 +15084,9 @@ [email protected]:
semver "^5.0.1"

ts-loader@^5.3.3:
version "5.4.5"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.4.5.tgz#a0c1f034b017a9344cef0961bfd97cc192492b8b"
integrity sha512-XYsjfnRQCBum9AMRZpk2rTYSVpdZBpZK+kDh0TeT3kxmQNBDVIeUjdPjY5RZry4eIAb8XHc4gYSUiUWPYvzSRw==
version "5.4.4"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-5.4.4.tgz#2b2c11e0bc917db27b2de7011ad1a9d6413c5ab1"
integrity sha512-haLwWMts/tCruBFbLUWOR9hZezZ89TMW3EntrAEtYARDnPZSQt6dPA5tN3fvlsmUIYXVWDHO5SUhw8ndAomVlw==
dependencies:
chalk "^2.3.0"
enhanced-resolve "^4.0.0"
Expand Down

0 comments on commit 96eb511

Please sign in to comment.