Skip to content

Commit

Permalink
build: fix typescript component resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra committed Nov 3, 2020
1 parent c02daf8 commit 7e3722b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"build": "concurrently yarn:build:*",
"build:cjs": "cross-env BABEL_ENV=cjs babel src --extensions .ts,.tsx -d dist/cjs --source-maps",
"build:esm": "cross-env BABEL_ENV=esm babel src --extensions .ts,.tsx -d dist/esm --source-maps",
"build:types": "tsc --emitDeclarationOnly",
"check-types": "tsc --noEmit",
"build:types": "tsc --emitDeclarationOnly --project tsconfig.prod.json",
"check-types": "tsc --noEmit --project tsconfig.prod.json",
"commit": "gacp",
"format": "prettier --write \"./**/*.{js,ts,css,less,json,md,html,yml,yaml,pcss,jsx,tsx}\"",
"generatejs": "node scripts/generate-js",
Expand Down Expand Up @@ -71,7 +71,7 @@
"@storybook/addon-actions": "6.0.28",
"@storybook/addon-essentials": "6.0.28",
"@storybook/react": "6.0.28",
"@testing-library/jest-dom": "5.11.5",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "11.1.0",
"@testing-library/react-hooks": "3.4.2",
"@testing-library/user-event": "12.1.10",
Expand Down
27 changes: 15 additions & 12 deletions src/slider/stories/Slider.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ export const App: React.FC<AppProps> = args => {
<div
className="slider-filled-track"
style={{
width: !isVertical && trackWidth,
height: isVertical && trackWidth,
left: !isReversed && !isVertical && trackLeft,
right: isReversed && trackRight,
bottom: isVertical && isRange && `${getThumbPercent(0) * 100}%`,
width: !isVertical ? trackWidth : "",
height: isVertical ? trackWidth : "",
left: !isReversed && !isVertical && trackLeft ? trackLeft : "",
right: isReversed ? trackRight : "",
bottom:
isVertical && isRange ? `${getThumbPercent(0) * 100}%` : "",
}}
/>
) : null}
Expand All @@ -156,14 +157,16 @@ export const App: React.FC<AppProps> = args => {
className="slider-thumb"
key={`thumb-${index}`}
style={{
right:
isReversed && `calc(${getThumbPercent(index) * 100}% - 7px)`,
right: isReversed
? `calc(${getThumbPercent(index) * 100}% - 7px)`
: "",
left:
!isReversed &&
!isVertical &&
`calc(${getThumbPercent(index) * 100}% - 7px)`,
bottom:
isVertical && `calc(${getThumbPercent(index) * 100}% - 7px)`,
!isReversed && !isVertical
? `calc(${getThumbPercent(index) * 100}% - 7px)`
: "",
bottom: isVertical
? `calc(${getThumbPercent(index) * 100}% - 7px)`
: "",
}}
>
<SliderThumb
Expand Down
11 changes: 7 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"module": "esnext",
"lib": ["dom", "esnext"],
Expand All @@ -20,8 +21,10 @@
"types": ["node", "jest", "@testing-library/jest-dom"],
"sourceMap": true,
"declaration": true,
"declarationDir": "dist/types"
},
"include": ["src"],
"exclude": ["**/*/stories", "**/*/__tests__"]
"declarationDir": "dist/types",
"paths": {
"renderless-components": ["src"],
"renderless-components/*": ["src/*"]
}
}
}
5 changes: 5 additions & 0 deletions tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": ["**/*/stories", "**/*/__tests__"]
}
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2781,7 +2781,7 @@
lz-string "^1.4.4"
pretty-format "^26.4.2"

"@testing-library/[email protected]":
"@testing-library/jest-dom@^5.11.5":
version "5.11.5"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.11.5.tgz#44010f37f4b1e15f9d433963b515db0b05182fc8"
integrity sha512-XI+ClHR864i6p2kRCEyhvpVejuer+ObVUF4cjCvRSF88eOMIfqw7RoS9+qoRhyigGswMfT64L6Nt0Ufotxbwtg==
Expand Down

0 comments on commit 7e3722b

Please sign in to comment.