Skip to content

Commit

Permalink
build(forma-36-react-components): build with tsdx
Browse files Browse the repository at this point in the history
  • Loading branch information
denkristoffer committed Nov 10, 2020
1 parent 44b60e6 commit 5523158
Show file tree
Hide file tree
Showing 396 changed files with 4,289 additions and 4,024 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"packages/components/*"
],
"nohoist": [
"@contentful/forma-36-fcss/node-sass-import",
"**/tsdx",
"**/tsdx/**"
"@contentful/forma-36-fcss/node-sass-import"
]
},
"devDependencies": {
Expand Down
20 changes: 10 additions & 10 deletions packages/components/forma-36-react-timepicker/src/Timepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ function parseRawInput(raw: string) {
'hh',
'HH',
]
.map((timeFormat) =>
.map(timeFormat =>
parse(normalisedValue, `${DATE_NOW_FORMAT} ${timeFormat}`, new Date()),
)
.filter((date) => isValid(date));
.filter(date => isValid(date));

if (times.length === 0) {
return null;
Expand All @@ -120,7 +120,7 @@ type hour = {

function getSuggestionList(value: string, date: string) {
let isActive = true;
return allHourSuggestions.map((timeSuggestion) => {
return allHourSuggestions.map(timeSuggestion => {
if (
isBefore(
parse(
Expand Down Expand Up @@ -233,7 +233,7 @@ const TimePicker: React.FC<TimepickerProps> = ({
);

const handleChange = useCallback(
(val) => {
val => {
setSelectedTime(val);
const parsedTime = parseRawInput(val);
if (parsedTime && isValid(parsedTime)) {
Expand All @@ -246,12 +246,12 @@ const TimePicker: React.FC<TimepickerProps> = ({
);

const handleKeyUp = useCallback(
(event) => {
event => {
if (isHotkey('enter', event)) {
setTimeSuggestionOpen(false);
}

const activeIndex = filteredHours.findIndex((elem) => elem.isActive);
const activeIndex = filteredHours.findIndex(elem => elem.isActive);
let nextIndex = 0;

if (isHotkey('arrowUp', event) && filteredHours[activeIndex + 1]) {
Expand All @@ -269,20 +269,20 @@ const TimePicker: React.FC<TimepickerProps> = ({
[handleChange, filteredHours],
);

const handleKeyDown = useCallback((event) => {
const handleKeyDown = useCallback(event => {
if (isHotkey('arrowUp', event) || isHotkey('arrowDown', event)) {
event.preventDefault();
}
}, []);

const handleFocus = useCallback((e) => {
const handleFocus = useCallback(e => {
e.preventDefault();
e.target.select();
setTimeSuggestionOpen(true);
}, []);

const handleBlur = useCallback(
(e) => {
e => {
const time = getTimeFromUserInputOrDefaultToValue();
setSelectedTime(time);
closeDropdown(e);
Expand Down Expand Up @@ -323,7 +323,7 @@ const TimePicker: React.FC<TimepickerProps> = ({
onKeyDown={handleKeyDown}
onFocus={handleFocus}
onBlur={handleBlur}
onChange={(e) => handleChange(e.target.value)}
onChange={e => handleChange(e.target.value)}
disabled={disabled}
autoComplete="off"
/>
Expand Down
36 changes: 0 additions & 36 deletions packages/forma-36-react-components/.babelrc

This file was deleted.

18 changes: 0 additions & 18 deletions packages/forma-36-react-components/.size-limit

This file was deleted.

164 changes: 68 additions & 96 deletions packages/forma-36-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,143 +3,97 @@
"description": "Contentful UI Component Library",
"version": "3.64.3",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"module": "dist/forma-36-react-components.esm.js",
"style": "dist/styles.css",
"license": "MIT",
"types": "dist/index.d.ts",
"files": [
"package.json",
"dist"
],
"sideEffects": [
"*.css"
"dist",
"src"
],
"engines": {
"node": ">=10"
},
"scripts": {
"analyze": "size-limit --why",
"build-storybook": "build-storybook",
"build": "tsdx build --entry src/index.ts --entry src/alpha.ts && yarn post-build",
"generate": "yarn plop --plopfile ./tools/plopfile.js",
"lint": "tsdx lint",
"post-build": "node ./tools/postBuild.js",
"semantic-release": "semantic-release",
"size": "size-limit",
"start": "start-storybook -p 9001 -c ./tools/.storybook -s ./tools/.storybook/public",
"storybook": "yarn build-storybook -c tools/.storybook -s ./tools/.storybook/public -o dist-storybook",
"test": "tsdx test --passWithNoTests"
},
"peerDependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"dependencies": {
"@popperjs/core": "^2.4.4",
"classnames": "^2.2.6",
"dayjs": "^1.9.1",
"react-animate-height": "^2.0.7",
"react-copy-to-clipboard": "^5.0.1",
"react-modal": "^3.11.2",
"react-popper": "^2.2.3",
"react-transition-group": "^2.4.0",
"truncate": "^2.0.1"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/core": "^7.12.3",
"@babel/polyfill": "7.2.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "7.3.3",
"@contentful/forma-36-fcss": "^0.2.12",
"@contentful/forma-36-tokens": "^0.9.2",
"@rollup/plugin-url": "^5.0.1",
"@size-limit/preset-big-lib": "^4.5.5",
"@storybook/addon-a11y": "^6.0.28",
"@storybook/addon-essentials": "^6.0.28",
"@storybook/addon-knobs": "^6.0.28",
"@storybook/addon-storysource": "^6.0.28",
"@storybook/addons": "^6.0.28",
"@storybook/react": "6.0.28",
"@storybook/theming": "^6.0.28",
"@svgr/rollup": "^5.4.0",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@types/classnames": "2.2.7",
"@types/enzyme": "^3.10.7",
"@types/enzyme": "3.9.1",
"@types/jest": "^24.0.25",
"@types/jest-axe": "^3.5.1",
"@types/jest-axe": "^3.2.1",
"@types/react": "16.8.6",
"@types/react-color": "^3.0.1",
"@types/react-copy-to-clipboard": "4.2.6",
"@types/react-dom": "16.8.4",
"@types/react-dom": "^16.9.8",
"@types/react-transition-group": "2.0.15",
"@types/storybook__react": "5.2.1",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5",
"babel-plugin-add-react-displayname": "^0.0.5",
"babel-plugin-css-modules-transform": "^1.6.2",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-inline-react-svg": "^1.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-typescript-to-proptypes": "0.17.1",
"css-loader": "^1.0.1",
"cz-conventional-changelog": "^2.1.0",
"babel-loader": "^8.1.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.9.1",
"enzyme-to-json": "^3.3.5",
"eslint": "5.16.0",
"eslint-config-dev": "2.0.0",
"eslint-config-prettier": "4.2.0",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-jest": "22.5.1",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react-hooks": "^4.2.0",
"file-loader": "^3.0.1",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.9.0",
"jest-axe": "^3.2.0",
"markdown-it": "^8.4.2",
"mini-css-extract-plugin": "^0.7.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
"plop": "^2.5.3",
"postcss": "^7.0.5",
"postcss-copy-assets": "^0.3.1",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0",
"postcss-url": "^8.0.0",
"react-docgen-typescript-loader": "3.1.0",
"react-test-renderer": "^16.8.3",
"rollup": "^1.8.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.0",
"rollup-plugin-local-resolve": "^1.0.7",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-replace": "^2.1.1",
"rollup-plugin-terser": "^4.0.4",
"semantic-release": "^15.14.0",
"size-limit": "^4.5.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-is": "^16.13.1",
"rollup-plugin-postcss": "^3.1.8",
"size-limit": "^4.6.2",
"storybook-addon-jsx": "^7.3.4",
"storybook-prop-types-addon": "1.0.2",
"style-loader": "^0.23.1",
"travis-deploy-once": "^4.4.1",
"typescript": "3.9.7",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.5"
},
"dependencies": {
"@babel/runtime": "^7.3.4",
"@popperjs/core": "^2.4.4",
"classnames": "^2.2.6",
"dayjs": "^1.9.1",
"react-animate-height": "^2.0.7",
"react-copy-to-clipboard": "^5.0.1",
"react-modal": "^3.11.2",
"react-popper": "^2.2.3",
"react-transition-group": "^2.4.0",
"truncate": "^2.0.1"
},
"peerDependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"scripts": {
"start": "start-storybook -p 9001 -c ./tools/.storybook -s ./tools/.storybook/public",
"test": "jest",
"build:clean": "rm -rf dist esm",
"build:scripts": "BABEL_ENV=build yarn babel src --out-dir dist --ignore 'src/**/*.stories.js','src/**/*.stories.tsx','src/**/*.test.tsx','src/**/*.test.js','src/**/*.css.d.ts' --extensions '.ts','.tsx','.js'",
"build:esm": "BABEL_ENV=esm yarn babel src --out-dir esm --ignore 'src/**/*.stories.js','src/**/*.stories.tsx','src/**/*.test.tsx','src/**/*.test.js','src/**/*.css.d.ts' --extensions '.ts','.tsx','.js' && rollup -c tools/rollup.esm.config.js && rm -rf esm",
"build:styles": "yarn webpack --config ./tools/webpack.production.config.js",
"build:umd": "rollup -c tools/rollup.umd.config.js",
"build:types": "tsc --emitDeclarationOnly",
"build:post-clean": "rm -rf dist/styles.js dist/main.js",
"build": "yarn build:clean && yarn build:scripts && yarn build:esm && yarn build:styles && yarn build:types && yarn build:umd && yarn size && yarn build:post-clean",
"size": "size-limit",
"generate": "yarn plop --plopfile ./tools/plopfile.js",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint": "yarn eslint",
"add-component": "yarn generate component",
"add-documentation": "yarn generate documentation",
"prepublishOnly": "yarn lint && yarn test && yarn build",
"travis-deploy-once": "travis-deploy-once --pro",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"semantic-release": "semantic-release",
"storybook": "yarn build-storybook -c tools/.storybook -s ./tools/.storybook/public -o dist-storybook"
"tsdx": "^0.14.1",
"tslib": "^2.0.3",
"typescript": "3.9.7"
},
"jest": {
"globalSetup": "<rootDir>/test/config/globalSetup.js",
Expand All @@ -160,6 +114,24 @@
"enzyme-to-json/serializer"
]
},
"size-limit": [
{
"path": "dist/index.js",
"name": "gzipped js",
"gzip": false,
"limit": "376 KB",
"ignore": [
"react",
"react-dom"
]
},
{
"path": "dist/styles.css",
"name": "gzipped css",
"limit": "75 KB",
"gzip": false
}
],
"repository": {
"type": "git",
"url": "https://github.com/contentful/forma-36.git"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export const basic = ({ align, ...args }: AccordionProps) => (
);
basic.args = {
align: 'end',
['AccordionItem Title #1']: 'Accordion I',
['AccordionItem Content #1']: defaultText,
['AccordionItem Title #2']: 'Accordion II',
['AccordionItem Content #2']: defaultText,
['AccordionItem Title #3']: 'Accordion III',
['AccordionItem Content #3']: defaultText,
'AccordionItem Title #1': 'Accordion I',
'AccordionItem Content #1': defaultText,
'AccordionItem Title #2': 'Accordion II',
'AccordionItem Content #2': defaultText,
'AccordionItem Title #3': 'Accordion III',
'AccordionItem Content #3': defaultText,
};
Loading

0 comments on commit 5523158

Please sign in to comment.