Skip to content

Commit

Permalink
🔨 chore(react): add build script
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Mar 24, 2022
1 parent 2f776b6 commit 82a965e
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 15 deletions.
6 changes: 5 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"es"
],
"scripts": {
"generate": "esno ./scripts/generate.ts"
"generate": "esno ./scripts/generate.ts",
"build:clean": "esno ./scripts/buildClean.ts",
"build:es": "tsc --project tsconfig.build.json --module esnext --outDir es",
"build:lib": "tsc --project tsconfig.build.json --module commonjs --outDir lib",
"build": "pnpm run build:clean && pnpm run build:es && pnpm run build:lib"
},
"peerDependencies": {
"react": ">=16.0.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/react/scripts/buildClean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import del from 'del';

del(['es', 'lib']);
2 changes: 1 addition & 1 deletion packages/react/src/components/IconBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const IconBase: IconBaseComponent<IconProps> = ({
if (target && typeof target.icon === 'function') {
target = {
...target,
icon: target.icon(colors.primaryColor, colors.secondaryColor),
icon: target.icon(colors.primaryColor, colors.secondaryColor as string),
};
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/twoTonePrimaryColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export function getTwoToneColor(): TwoToneColor {
if (!colors.calculated) {
return colors.primaryColor;
}
return [colors.primaryColor, colors.secondaryColor];
return [colors.primaryColor, colors.secondaryColor as string];
}
7 changes: 4 additions & 3 deletions packages/react/src/icons/AccountBookFilled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as React from 'react'
import AccountBookFilledSvg from '@lotus-design/icons-svg/lib/asn/AccountBookFilled';
import LotusIcon, { LotusIconProps } from '../components/LotusIcon';

const AccountBookFilled = (props, ref) =>
<LotusIcon {...props} ref={ref} icon={AccountBookFilledSvg} />;
const AccountBookFilled = React.forwardRef<HTMLSpanElement, LotusIconProps>(
(props, ref) => <LotusIcon {...props} ref={ref} icon={AccountBookFilledSvg} />
);

AccountBookFilled.displayName = 'AccountBookFilled';

export default React.forwardRef<HTMLSpanElement, LotusIconProps>(AccountBookFilled);
export default AccountBookFilled;
7 changes: 4 additions & 3 deletions packages/react/src/icons/AccountBookOutlined.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as React from 'react'
import AccountBookOutlinedSvg from '@lotus-design/icons-svg/lib/asn/AccountBookOutlined';
import LotusIcon, { LotusIconProps } from '../components/LotusIcon';

const AccountBookOutlined = (props, ref) =>
<LotusIcon {...props} ref={ref} icon={AccountBookOutlinedSvg} />;
const AccountBookOutlined = React.forwardRef<HTMLSpanElement, LotusIconProps>(
(props, ref) => <LotusIcon {...props} ref={ref} icon={AccountBookOutlinedSvg} />
);

AccountBookOutlined.displayName = 'AccountBookOutlined';

export default React.forwardRef<HTMLSpanElement, LotusIconProps>(AccountBookOutlined);
export default AccountBookOutlined;
7 changes: 4 additions & 3 deletions packages/react/src/icons/AccountBookTwoTone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as React from 'react'
import AccountBookTwoToneSvg from '@lotus-design/icons-svg/lib/asn/AccountBookTwoTone';
import LotusIcon, { LotusIconProps } from '../components/LotusIcon';

const AccountBookTwoTone = (props, ref) =>
<LotusIcon {...props} ref={ref} icon={AccountBookTwoToneSvg} />;
const AccountBookTwoTone = React.forwardRef<HTMLSpanElement, LotusIconProps>(
(props, ref) => <LotusIcon {...props} ref={ref} icon={AccountBookTwoToneSvg} />
);

AccountBookTwoTone.displayName = 'AccountBookTwoTone';

export default React.forwardRef<HTMLSpanElement, LotusIconProps>(AccountBookTwoTone);
export default AccountBookTwoTone;
7 changes: 4 additions & 3 deletions packages/react/src/icons/AlertFilled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as React from 'react'
import AlertFilledSvg from '@lotus-design/icons-svg/lib/asn/AlertFilled';
import LotusIcon, { LotusIconProps } from '../components/LotusIcon';

const AlertFilled = (props, ref) =>
<LotusIcon {...props} ref={ref} icon={AlertFilledSvg} />;
const AlertFilled = React.forwardRef<HTMLSpanElement, LotusIconProps>(
(props, ref) => <LotusIcon {...props} ref={ref} icon={AlertFilledSvg} />
);

AlertFilled.displayName = 'AlertFilled';

export default React.forwardRef<HTMLSpanElement, LotusIconProps>(AlertFilled);
export default AlertFilled;
8 changes: 8 additions & 0 deletions packages/react/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es5",
"declaration": true
},
"include": ["src/**/*"]
}
12 changes: 12 additions & 0 deletions packages/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"module": "commonjs",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"skipLibCheck": true
}
}

0 comments on commit 82a965e

Please sign in to comment.