Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added typescript declarations to core-react #625

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/core-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/core-react.cjs.js",
"module": "dist/core-react.es.js",
"browser": "dist/core-react.umd.js",
"types": "dist/types/index.d.ts",
"license": "AGPL-3.0-or-later",
"author": {
"name": "EDS Core Team",
Expand Down Expand Up @@ -46,7 +47,6 @@
"@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^8.0.1",
"@rollup/plugin-typescript": "^5.0.2",
"@testing-library/jest-dom": "^5.9.0",
"@testing-library/react": "^10.2.1",
"@testing-library/user-event": "^10.3.2",
Expand All @@ -65,6 +65,7 @@
"react-dom": "^16.13.1",
"rollup": "^2.15.0",
"rollup-plugin-polyfill": "^3.0.0",
"rollup-plugin-typescript2": "^0.27.2",
"styled-components": "4.4.1",
"ts-jest": "^26.3.0",
"tslib": "^2.0.1",
Expand Down
67 changes: 49 additions & 18 deletions libraries/core-react/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions libraries/core-react/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import babel from '@rollup/plugin-babel'
import polyfill from 'rollup-plugin-polyfill'
import typescript from '@rollup/plugin-typescript'
import typescript from 'rollup-plugin-typescript2'

import pkg from './package.json'

Expand All @@ -17,11 +17,10 @@ const globals = {
'styled-components': 'styled',
}

const buildForStorybook = process.env.STORYBOOK
const extensions = ['.jsx', '.js', '.tsx', '.ts']
export default [
{
input: './src/index.js',
input: './src/index.ts',
external: peerDeps,
watch: {
clearScreen: true,
Expand All @@ -30,7 +29,7 @@ export default [
plugins: [
json(),
resolve({ extensions }),
typescript(),
typescript({ useTsconfigDeclarationDir: true }),
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled',
Expand All @@ -50,7 +49,10 @@ export default [
sourcemap: true,
globals,
},
...(buildForStorybook ? [] : [{ file: pkg.main, format: 'cjs' }]),
{
file: pkg.main,
format: 'cjs',
},
],
},
]
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/Menu.context.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { useState, useContext } from 'react'
import PropTypes from 'prop-types'

Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { useEffect, useRef } from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/Menu.test.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/* eslint-disable no-undef */
import React from 'react'
import { render, cleanup, screen, fireEvent } from './test-utils'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/MenuItem.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/MenuList.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { useEffect } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/MenuSection.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Menu/index.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import { Menu as BaseMenu } from './Menu'
import { MenuItem } from './MenuItem'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Paper/Paper.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable import/prefer-default-export */
// @ts-nocheck
export { Button } from './Button'
export { Typography } from './Typography'
export { Table } from './Table'
Expand Down
5 changes: 5 additions & 0 deletions libraries/core-react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./dist/types",
"outDir": "./dist"
},
"include": ["./src/**/*.ts*"],
"exclude": ["node_modules"]
}