Skip to content

Commit b04dc25

Browse files
authored
Merge pull request #2222 from Akshat55/compo-storybook
docs: Integrate compodoc with storybook
2 parents cf8ead5 + eb83531 commit b04dc25

File tree

153 files changed

+6570
-3747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+6570
-3747
lines changed

.storybook/main.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
module.exports = {
2-
"stories": [
2+
staticDirs: ["public"],
3+
stories: [
34
"../src/**/*.stories.mdx",
45
"../src/**/*.stories.@(js|jsx|ts|tsx)"
56
],
6-
"addons": [
7+
addons: [
78
"@storybook/addon-links",
89
{
910
name: "@storybook/addon-essentials",
1011
options: {
1112
backgrounds: false
1213
}
13-
}
14+
},
15+
"@storybook/addon-a11y"
1416
],
15-
"framework": "@storybook/angular",
16-
"core": {
17-
"builder": "webpack5"
17+
framework: "@storybook/angular",
18+
core: {
19+
builder: "webpack5",
20+
disableTelemetry: true,
1821
},
1922
webpack(config) {
2023
config.module.rules.push({

.storybook/manager.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ addons.setConfig({
88
fontCode:
99
"'IBM Plex Mono', Menlo, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace",
1010
brandTitle: `carbon components angular`,
11-
brandUrl:
12-
'https://github.com/carbon-design-system/carbon/tree/main/packages/react',
11+
brandUrl: 'https://github.com/IBM/carbon-components-angular',
1312
})
1413
});

.storybook/preview.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,47 @@
22
import "!style-loader!css-loader!postcss-loader!sass-loader!./preview.scss";
33
import { breakpoints } from '@carbon/layout';
44

5+
// Add compodoc
6+
import { setCompodocJson } from "@storybook/addon-docs/angular";
7+
import {
8+
classes,
9+
components,
10+
directives,
11+
interfaces,
12+
miscellaneous,
13+
pipes
14+
} from "../dist/docs/documentation.json";
15+
16+
/**
17+
* Remove public properties from docs Json for each component.
18+
* This is to prevent properties like `onTouched = () => {...}` & `propagateChange = () => {}`
19+
* from being rewritten as string by storybook.
20+
*/
21+
components = components.map(comp => {
22+
return {
23+
...comp,
24+
// Removes properties
25+
propertiesClass: [],
26+
outputsClass: comp.outputsClass.map((output) => {
27+
return {
28+
...output,
29+
// Prevents control type appearing as `string`
30+
defaultValue: undefined
31+
}
32+
})
33+
}
34+
});
35+
36+
// Integrate compodoc documentation with storybook
37+
setCompodocJson({
38+
classes,
39+
components,
40+
directives,
41+
interfaces,
42+
miscellaneous,
43+
pipes
44+
});
45+
546
// Set carbon viewports options
647
export const parameters = {
748
viewport: {
@@ -42,6 +83,9 @@ export const parameters = {
4283
},
4384
},
4485
},
86+
},
87+
controls: {
88+
expanded: true
4589
}
4690
};
4791

angular.json

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,18 @@
4949
"styles": [
5050
"./.storybook/preview.scss"
5151
],
52-
"compodoc": false
52+
"compodoc": true,
53+
"compodocArgs": [
54+
"-e",
55+
"json",
56+
"--disablePrivate",
57+
"--disableProtected",
58+
"--disableLifeCycleHooks",
59+
"--disableInternal",
60+
"-d",
61+
"dist/docs/"
62+
],
63+
"configDir": ".storybook"
5364
}
5465
},
5566
"build-storybook": {
@@ -59,7 +70,18 @@
5970
"styles": [
6071
"./.storybook/preview.scss"
6172
],
62-
"compodoc": false,
73+
"compodoc": true,
74+
"compodocArgs": [
75+
"-e",
76+
"json",
77+
"--disablePrivate",
78+
"--disableProtected",
79+
"--disableLifeCycleHooks",
80+
"--disableInternal",
81+
"-d",
82+
"dist/docs/",
83+
"-t"
84+
],
6385
"configDir": ".storybook",
6486
"outputDir": "dist/docs/storybook"
6587
}

carbon-angular-typedoc-theme/helpers/helpers.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

carbon-angular-typedoc-theme/partials/analytics.hbs

Lines changed: 0 additions & 9 deletions
This file was deleted.

carbon-angular-typedoc-theme/partials/index.hbs

Lines changed: 0 additions & 64 deletions
This file was deleted.

carbon-angular-typedoc-theme/partials/member.hbs

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)