Skip to content

Commit bcf8024

Browse files
committed
Merge branch 'feat/5444-storybook' into 'master'
(infra): support for storybook - #5444 See merge request minds/front!1853
2 parents ed77972 + d195a1c commit bcf8024

17 files changed

+51482
-19803
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ cypress/videos
4747
!.gitkeep
4848
!/.nvmrc
4949
!/.husky
50+
!/.storybook
5051
cypress-tests

.storybook/main.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
"stories": [
3+
"../src/**/*.stories.mdx",
4+
"../src/**/*.stories.@(js|jsx|ts|tsx)"
5+
],
6+
"addons": [
7+
"@storybook/addon-links",
8+
"@storybook/addon-essentials",
9+
"@storybook/addon-interactions",
10+
"storybook-addon-themes",
11+
],
12+
"framework": "@storybook/angular",
13+
"core": {
14+
"builder": "@storybook/builder-webpack5"
15+
}
16+
}

.storybook/preview.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { setCompodocJson } from "@storybook/addon-docs/angular";
2+
import docJson from "../documentation.json";
3+
setCompodocJson(docJson);
4+
5+
export const parameters = {
6+
actions: { argTypesRegex: "^on[A-Z].*" },
7+
controls: {
8+
matchers: {
9+
color: /(background|color)$/i,
10+
date: /Date$/,
11+
},
12+
},
13+
docs: { inlineStories: true },
14+
themes: {
15+
clearable: false,
16+
list: [
17+
{
18+
name: "light mode",
19+
class: [ "m-theme__2020", "m-theme__light" ],
20+
color: "#FFF",
21+
default: true
22+
},
23+
{
24+
name: "dark mode",
25+
class: [ "m-theme__2020", "m-theme__dark" ],
26+
color: "#111",
27+
}
28+
]
29+
}
30+
}

.storybook/tsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../src/tsconfig.app.json",
3+
"exclude": [
4+
"../src/test.ts",
5+
"../src/**/*.spec.ts",
6+
"../projects/**/*.spec.ts"
7+
],
8+
"include": [
9+
"../src/**/*.stories.*",
10+
"../src/**/*.d.ts"
11+
]
12+
}

.storybook/typings.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.md' {
2+
const content: string;
3+
export default content;
4+
}

angular.json

+13
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,19 @@
238238
}
239239
},
240240
"defaultConfiguration": ""
241+
},
242+
"storybook": {
243+
"builder": "@storybook/angular:start-storybook",
244+
"options": {
245+
"browserTarget": "minds:build",
246+
"port": 6006
247+
}
248+
},
249+
"build-storybook": {
250+
"builder": "@storybook/angular:build-storybook",
251+
"options": {
252+
"browserTarget": "minds:build"
253+
}
241254
}
242255
}
243256
},

build/ng-bundles.sh

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
BROWSER_PATH=${1:-dist/browser}
44
EMBED_PATH=${1:-dist/embed}
55
SERVER_PATH=${3:-dist/server}
6+
STORYBOOK_PATH=${3:-dist/storybook}
67

78
# Allow Node.js to use up to 4G
89
export NODE_OPTIONS="--max_old_space_size=4096"
@@ -21,3 +22,8 @@ if [ "$?" != "0" ]; then exit 1; fi
2122
# Build SSR
2223
npm run build:ssr -- --outputPath=$SERVER_PATH
2324
if [ "$?" != "0" ]; then exit 1; fi
25+
26+
# Build Storybook
27+
npm run build-storybook
28+
if [ "$?" != "0" ]; then exit 1; fi
29+
mv "storybook-static/" $STORYBOOK_PATH

0 commit comments

Comments
 (0)