Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Adding a types barrel file instead
Browse files Browse the repository at this point in the history
  • Loading branch information
juliewongbandue committed Jul 14, 2023
1 parent 9aee308 commit 0926a1a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 29 deletions.
22 changes: 1 addition & 21 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';

import pkg from './package.json';

export default (args) => {
process.env.NODE_ENV = 'production';

const debug = args['config-debug'];

/** @type {import('rollup').RollupOptions} */
let config = {
input: './src/!(_docs|_labs|_process|storybook)*/**/!(*.story.tsx|*.test.ts|*.types.ts)',
Expand All @@ -30,23 +28,5 @@ export default (args) => {
plugins: [commonjs(), resolve(), typescript(), babel({ exclude: '**/node_modules', babelHelpers: 'runtime' }), multi()],
};

let typesConfig = {
input: './src/components/**/*.types.ts',
output: [
{
dir: 'build/types',
format: 'esm',
entryFileNames: '[name].esm.js',
},
{
dir: 'build/types',
format: 'commonjs',
entryFileNames: '[name].js',
},
],
external: Object.keys(pkg.peerDependencies),
plugins: [commonjs(), resolve(), typescript({ declarationDir: 'build/types', outDir: 'build/types' }), babel({ exclude: '**/node_modules', babelHelpers: 'runtime' }), multi()],
};

return [config, typesConfig];
return config;
};
2 changes: 1 addition & 1 deletion src/components/Badge/Badge.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type Props = IrisProps<

export type DOMElement = HTMLSpanElement | HTMLAnchorElement;

type Format =
export type Format =
| 'alum'
| 'beta'
| 'business'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Panel/Panel.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ export type Props = IrisProps<{
screen?: boolean;
}>;

type Resize = { min: number; max: number; current: number };
export type Resize = { min: number; max: number; current: number };
5 changes: 4 additions & 1 deletion src/components/Path/Path.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export const Path = withIris<HTMLDivElement, Props, Minors>(
PathComponent
);

type Props = IrisProps<{ children: ReactElement[] }, HTMLDivElement>;
export type Props = IrisProps<
{ children: ReactElement[] },
HTMLDivElement
>;

Path.Link = Link;
Path.Current = Current;
Expand Down
4 changes: 0 additions & 4 deletions src/components/Sidebar/Sidebar.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ export interface ItemPropsExtrinsic {
onClick?: MouseEventHandler;
}

export type ItemExtrinsic = (
props: ItemPropsExtrinsic
) => JSX.Element;

export type ItemPropsIntrinsic = ItemPropsExtrinsic & {
attach: Props['attach'];
onClick: MouseEventHandler;
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/FileUpload/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const FileUpload = withIris<HTMLInputElement, Props>(
FileUploadComponent
);

type Props = IrisInputProps;
export type Props = IrisInputProps;

function FileUploadComponent({
children,
Expand Down
43 changes: 43 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export { Props as AvatarProps, Size as AvatarSizeProps } from '../components/Avatar/Avatar.types';
export { Props as BadgeProps, Format as BadgeFormatProps } from '../components/Badge/Badge.types';
export { Props as ButtonProps } from '../components/Button/Button.types';
export { Props as CardProps } from '../components/Card/Card';
export { Props as CardCategoryProps } from '../components/CardCategory/CardCategory';
export { Props as CheckboxProps } from '../components/inputs/Checkbox/Checkbox';
export { Props as CheckboxSetProps } from '../components/inputs/Checkbox/CheckboxSet.types';
export { Props as ColorSelect2Props } from '../components/inputs/ColorSelect2/ColorSelect2.types';
export { Props as CopyFieldProps } from '../components/inputs/CopyField/CopyField';
export { Props as CalendarProps } from '../components/inputs/Dates/Calendar/Calendar';
export { Props as DateRangeProps } from '../components/inputs/Dates/DateRange/DateRange.types';
export { Props as DateSelectProps } from '../components/inputs/Dates/DateSelect/DateSelect';
export { Props as DropZoneProps } from '../components/inputs/Dropzone/Dropzone.types';
export { Props as FileUploadProps } from '../components/inputs/FileUpload/FileUpload';
export { Props as InputProps } from '../components/inputs/Input/Input.types';
export { Props as PasswordProps } from '../components/inputs/Password/Password';
export { Props as RadioProps } from '../components/inputs/Radio/Radio';
export { Props as RadioSetProps } from '../components/inputs/Radio/RadioSet';
export { Props as SearchProps } from '../components/inputs/Search/Search';
export { Props as SelectProps } from '../components/inputs/Select/Select.types';
export { State as SelectState } from '../components/inputs/Select/Select.state';
export { Props as SliderProps } from '../components/inputs/Slider/Slider.types';
export { Props as TextAreaProps } from '../components/inputs/TextArea/TextArea.types';
export { Props as ToggleProps } from '../components/inputs/Toggle/Toggle';
export { Props as WithCharacterCountProps } from '../components/inputs/withCharacterCount/withCharacterCount.types';
export { Props as LoaderCircularProps } from '../components/LoaderCircular/LoaderCircular.types';
export { Props as MenuProps } from '../components/Menu/Menu';
export { Minors as MenuMinorProps } from '../components/Menu/Menu.minors';
export { Props as ModalProps } from '../components/Modal/Modal.types';
export { Props as NoticeProps } from '../components/Notice/Notice';
export { Props as NotificationProps } from '../components/Notification/Notification';
export { Props as PaginationProps, PaginationChangeEvent } from '../components/Pagination/Pagination.types';
export { Props as PanelProps, Resize as PanelResize } from '../components/Panel/Panel.types';
export { Minors as PathMinorProps } from '../components/Path/Path.minors';
export { Props as PathProps } from '../components/Path/Path';
export { Props as PopOverProps } from '../components/PopOver/PopOver.types';
export { Props as ProgressProps } from '../components/Progress/Progress';
export { Props as RibbonProps } from '../components/Ribbon/Ribbon.types';
export { Props as SidebarProps, ItemPropsIntrinsic as SidebarItemProps, Minors as SidebarMinors } from '../components/Sidebar/Sidebar.types';
export { Props as TabsProps, PanelProps as TabsPanelProps } from '../components/Tabs/Tabs.types';
export { Props as TagProps, Sizes as TagSizes } from '../components/Tag/Tag.types';
export { Props as TipProps } from '../components/Tip/Tip.types';
export { Props as TourPointProps } from '../components/TourPoint/TourPoint.types';

0 comments on commit 0926a1a

Please # to comment.