Skip to content

Commit d5e3f18

Browse files
Chau TranChau Tran
Chau Tran
authored and
Chau Tran
committed
chore(soba): init storybook
1 parent 4a55dd6 commit d5e3f18

File tree

9 files changed

+2484
-96
lines changed

9 files changed

+2484
-96
lines changed

libs/soba/.storybook/main.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const config = {
2+
stories: ['../**/*.stories.@(js|jsx|ts|tsx|mdx)'],
3+
addons: ['@storybook/addon-essentials'],
4+
framework: {
5+
name: '@storybook/angular',
6+
options: {},
7+
},
8+
};
9+
10+
export default config;
11+
12+
// To customize your webpack configuration you can use the webpackFinal field.
13+
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
14+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs

libs/soba/.storybook/preview.js

Whitespace-only changes.

libs/soba/.storybook/tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"emitDecoratorMetadata": true
5+
},
6+
7+
"exclude": ["../**/*.spec.ts"],
8+
"include": [
9+
"../src/**/*.stories.ts",
10+
"../src/**/*.stories.js",
11+
"../src/**/*.stories.jsx",
12+
"../src/**/*.stories.tsx",
13+
"../src/**/*.stories.mdx",
14+
"*.js"
15+
]
16+
}

libs/soba/project.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,47 @@
4242
"options": {
4343
"lintFilePatterns": ["libs/soba/**/*.ts", "libs/soba/**/*.html"]
4444
}
45+
},
46+
"storybook": {
47+
"executor": "@storybook/angular:start-storybook",
48+
"options": {
49+
"port": 4400,
50+
"configDir": "libs/soba/.storybook",
51+
"browserTarget": "soba:build-storybook",
52+
"compodoc": false
53+
},
54+
"configurations": {
55+
"ci": {
56+
"quiet": true
57+
}
58+
}
59+
},
60+
"build-storybook": {
61+
"executor": "@storybook/angular:build-storybook",
62+
"outputs": ["{options.outputDir}"],
63+
"options": {
64+
"outputDir": "dist/storybook/soba",
65+
"configDir": "libs/soba/.storybook",
66+
"browserTarget": "soba:build-storybook",
67+
"compodoc": false
68+
},
69+
"configurations": {
70+
"ci": {
71+
"quiet": true
72+
}
73+
}
74+
},
75+
"static-storybook": {
76+
"executor": "@nx/web:file-server",
77+
"options": {
78+
"buildTarget": "soba:build-storybook",
79+
"staticFilePath": "dist/storybook/soba"
80+
},
81+
"configurations": {
82+
"ci": {
83+
"buildTarget": "soba:build-storybook:ci"
84+
}
85+
}
4586
}
4687
}
4788
}

libs/soba/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
},
1818
{
1919
"path": "./tsconfig.spec.json"
20+
},
21+
{
22+
"path": "./.storybook/tsconfig.json"
2023
}
2124
],
2225
"extends": "../../tsconfig.base.json",

libs/soba/tsconfig.lib.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
"inlineSources": true,
88
"types": []
99
},
10-
"exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"],
10+
"exclude": [
11+
"src/**/*.spec.ts",
12+
"src/test-setup.ts",
13+
"jest.config.ts",
14+
"src/**/*.test.ts",
15+
"**/*.stories.ts",
16+
"**/*.stories.js"
17+
],
1118
"include": ["src/**/*.ts"]
1219
}

nx.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"default": {
66
"runner": "nx-cloud",
77
"options": {
8-
"cacheableOperations": ["build", "lint", "test", "e2e"],
8+
"cacheableOperations": ["build", "lint", "test", "e2e", "build-storybook"],
99
"accessToken": "OWIxOTExNDctYWVjOC00MTY5LWJmMDktYWVhYzg3ZjhlYTZlfHJlYWQtd3JpdGU="
1010
}
1111
}
@@ -20,6 +20,9 @@
2020
},
2121
"lint": {
2222
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
23+
},
24+
"build-storybook": {
25+
"inputs": ["default", "^production", "!{projectRoot}/.storybook/**/*"]
2326
}
2427
},
2528
"namedInputs": {
@@ -29,7 +32,9 @@
2932
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
3033
"!{projectRoot}/tsconfig.spec.json",
3134
"!{projectRoot}/jest.config.[jt]s",
32-
"!{projectRoot}/.eslintrc.json"
35+
"!{projectRoot}/.eslintrc.json",
36+
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
37+
"!{projectRoot}/.storybook/**/*"
3338
],
3439
"sharedGlobals": []
3540
},

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@
2424
"@nx/js": "16.1.1",
2525
"@nx/linter": "16.1.1",
2626
"@nx/plugin": "16.1.1",
27+
"@nx/storybook": "16.1.1",
28+
"@nx/web": "16.1.1",
2729
"@nx/workspace": "16.1.1",
2830
"@release-it/bumper": "^4.0.2",
2931
"@release-it/conventional-changelog": "^5.1.1",
3032
"@schematics/angular": "16.0.0",
33+
"@storybook/addon-essentials": "^7.0.8",
34+
"@storybook/angular": "^7.0.8",
35+
"@storybook/core-server": "^7.0.8",
3136
"@swc-node/register": "^1.6.4",
3237
"@swc/cli": "0.1.62",
3338
"@swc/core": "^1.3.49",
@@ -71,6 +76,8 @@
7176
"@swc/helpers": "0.5.1",
7277
"ngx-resize": "^2.0.0",
7378
"nice-color-palettes": "^3.0.0",
79+
"react": "^18.2.0",
80+
"react-dom": "^18.2.0",
7481
"rxjs": "~7.8.0",
7582
"three": "^0.150.1",
7683
"three-stdlib": "^2.21.8",

0 commit comments

Comments
 (0)