Skip to content

Commit 886c497

Browse files
authored
Merge pull request #9 from silinternational/feature/storybook
Feature/storybook
2 parents be41336 + 3f4079a commit 886c497

File tree

17 files changed

+16343
-3086
lines changed

17 files changed

+16343
-3086
lines changed

.github/workflows/gh-pages.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: github pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Set a branch name to trigger deployment
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '14'
18+
19+
- name: Cache dependencies
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.npm
23+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-node-
26+
27+
- run: npm ci
28+
- run: npm test
29+
30+
- name: Build
31+
run: npm run build
32+
33+
- name: Deploy
34+
uses: peaceiris/actions-gh-pages@v3
35+
if: github.ref == 'refs/heads/main'
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./storybook-static

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
77
lerna-debug.log*
8-
8+
storybook-static
99
# Diagnostic reports (https://nodejs.org/api/report.html)
1010
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
1111

.storybook/main.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
"stories": [
5+
"../**/*.stories.mdx",
6+
"../**/*.stories.@(js|jsx|ts|tsx|svelte)"
7+
],
8+
"addons": [
9+
"@storybook/addon-links",
10+
"@storybook/addon-essentials",
11+
"@storybook/addon-svelte-csf",
12+
"@storybook/preset-scss",
13+
"@storybook/addon-postcss"
14+
],
15+
"svelteOptions": {
16+
"emitCss": true,
17+
"preprocess": require("svelte-preprocess")()
18+
},
19+
"core": {
20+
"builder": "webpack5"
21+
},
22+
babel: async (options) => {
23+
options.presets[0][1].loose = true
24+
return options
25+
},
26+
webpackFinal: async (config, { configType }) => {
27+
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
28+
// You can change the configuration based on that.
29+
// 'PRODUCTION' is used when building the static version of storybook.
30+
31+
// Make whatever fine-grained changes you need
32+
config.resolve.fallback.crypto = false;
33+
config.resolve.alias.svelte = path.resolve('node_modules', 'svelte')
34+
35+
// config.module.rules[0].use[0].options.presets[0][1].loose = true
36+
// console.log('!!!!!!!!!!!!', JSON.stringify(config.module.rules[0].use[0].options, null, 4))
37+
// = [
38+
// '@babel/plugin-proposal-class-properties',
39+
// { loose: true }
40+
// ]
41+
42+
return config;
43+
},
44+
}

.storybook/preview.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import '!style-loader!css-loader!../components/global.css'
2+
3+
export const parameters = {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
}

0 commit comments

Comments
 (0)