Skip to content

Commit 78e272e

Browse files
committed
Tweak logic for pick up component
1 parent 5dd63b6 commit 78e272e

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

docs/build/bundle.012777c0.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/build/bundle.0335e54b.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
</head>
88
<body>
99
<div id="app"></div>
10-
<script type="text/javascript" src="build/bundle.012777c0.js"></script></body>
10+
<script type="text/javascript" src="build/bundle.0335e54b.js"></script></body>
1111
</html>

src/shared/components/langSwitch/LangSwitch.connect.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import { connect } from "react-redux";
22

33
import LangSwitch, { LangSwitchProps } from "./LangSwitch";
44

5-
// export {
6-
// LangSwitch,
7-
// LangSwitchProps,
8-
// };
9-
105
import { langSwitchAction } from "../../../actions";
116

127
interface OwnProps {

src/shared/components/langSwitch/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ const LangSwitch = require("./LangSwitch.connect").default;
44
<div>
55
<LangSwitch />
66
<p><FormattedMessage id={"greeting"} /></p>
7-
</div>
7+
</div>
88
```

styleguide.config.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
const glob = require("glob");
2+
const path = require("path");
3+
const fs = require("fs");
4+
15
module.exports = {
2-
components: "src/shared/components/**/*.{ts,tsx}",
6+
components: () => {
7+
return glob.sync("src/shared/components/**/*.{ts,tsx}").filter(file => {
8+
// Take only connect component if exists, ignore others.
9+
if (file.match(/connect.tsx$/)) {
10+
return true
11+
} else {
12+
const pathObject = path.parse(file);
13+
pathObject.ext = `.connect${pathObject.ext}`
14+
const { root, dir, ext, name } = pathObject;
15+
return !fs.existsSync(path.format({ root, dir, ext, name }));
16+
}
17+
});
18+
},
319
propsParser: require("react-docgen-typescript").parse,
420
webpackConfig: Object.assign({}, require("./webpack.config"), {}),
521
styleguideComponents: {
622
Wrapper: __dirname + "/src/styleguide/Wrapper.tsx",
723
},
8-
ignore: ["**/*.connect.tsx"],
924
styleguideDir: "docs",
1025
};

0 commit comments

Comments
 (0)