我正在使用 plop 为基于 React 的组件库生成组件。我有一个充满 Handlebars 模板的目录,这些模板用于创建新的组件目录,并且一切正常。我也有这个index.js
文件作为我的捆绑器的入口点。它只是充满了大量的进口和出口。它看起来像这样:
import { Badge } from './components/Badge';
import { Button, ButtonMemo } from './components/Button';
import { Column } from './components/Column';
import { ErrorBoundary } from './components/ErrorBoundary';
import { FormBasicInfo } from './components/FormBasicInfo';
import { FormLogin } from './components/FormLogin';
import { FormSignup } from './components/FormSignUp';
import { Icon } from './components/Icon';
import { Input } from './components/Input';
import { Link } from './components/Link';
import { Loader } from './components/Loader';
import { Logo } from './components/Logo';
import { Row } from './components/Row';
import { Select } from './components/Select';
import { SimpleMenu } from './components/SimpleMenu';
import { Slideshow } from './components/Slideshow';
import { Spinner } from './components/Spinner';
export {
Badge,
Button,
Column,
ErrorBoundary,
FormBasicInfo,
FormLogin,
FormSignup,
Icon,
Input,
Link,
Loader,
Logo,
Row,
Select,
SimpleMenu,
Slideshow,
Spinner,
};
生成新组件时,我也希望将新组件添加到此入口点文件中。这需要在顶部块添加一条导入线,在底部添加一条导出线。理想情况下,它仍会按字母顺序排序,但这不是硬性要求。
这可能吗?