Permalink
Browse files

feat: 🎸 export TypeScript types and improve build process

Export TypeScript types, build with tsc, remove Gulp, publish to NPM
only lib/ folder, upgrade TypeScript to latest, import React as
wildcard.
  • Loading branch information...
streamich committed Sep 30, 2018
1 parent 368cd7c commit c050afdcf9f3a779081127bea95144b1f6ffafe4
Showing with 274 additions and 1,203 deletions.
  1. +0 βˆ’24 .npmignore
  2. +0 βˆ’42 build/gulpfile.js
  3. +15 βˆ’16 package.json
  4. +1 βˆ’1 src/ActiveSensor/__story__/story.tsx
  5. +1 βˆ’1 src/AfterDraf/__story__/story.tsx
  6. +2 βˆ’2 src/AfterDraf/createSingleRunDraf.ts
  7. +2 βˆ’2 src/AfterDraf/index.ts
  8. +1 βˆ’1 src/AfterTimeout/__story__/story.tsx
  9. +1 βˆ’1 src/Alert/__story__/story.tsx
  10. +1 βˆ’1 src/BatterySensor/__story__/story.ts
  11. +1 βˆ’1 src/BrowserOnly/__story__/story.tsx
  12. +1 βˆ’1 src/Counter/__story__/story.tsx
  13. +1 βˆ’1 src/Dimmable/__story__/story.tsx
  14. +6 βˆ’6 src/Dimmable/index.ts
  15. +1 βˆ’1 src/Dimmer/__story__/story.tsx
  16. +1 βˆ’1 src/DropArea/__story__/story.tsx
  17. +3 βˆ’3 src/DropArea/index.ts
  18. +1 βˆ’1 src/ElectronOnly/__story__/story.tsx
  19. +1 βˆ’1 src/ErrorBoundary/__story__/story.tsx
  20. +1 βˆ’1 src/ExitSensor/__story__/story.tsx
  21. +4 βˆ’4 src/ExitSensor/index.ts
  22. +1 βˆ’1 src/Flipflop/__story__/story.tsx
  23. +1 βˆ’1 src/FocusSensor/__story__/story.tsx
  24. +1 βˆ’1 src/FullScreen/__story__/story.tsx
  25. +1 βˆ’1 src/GeoLocation/__story__/story.tsx
  26. +1 βˆ’1 src/GoogleAuth/__story__/story.tsx
  27. +7 βˆ’4 src/GoogleAuth/index.ts
  28. +1 βˆ’1 src/Group/__story__/story.tsx
  29. +1 βˆ’1 src/HoverSensor/__story__/story.tsx
  30. +1 βˆ’1 src/IdleSensor/__story__/story.tsx
  31. +1 βˆ’1 src/Img/__story__/story.tsx
  32. +1 βˆ’1 src/InlineWidthQuery/__story__/story.tsx
  33. +1 βˆ’1 src/Interpolation/__story__/story.tsx
  34. +1 βˆ’1 src/Lifecycles/__story__/story.tsx
  35. +1 βˆ’1 src/LightSensor/__story__/story.tsx
  36. +1 βˆ’1 src/List/__story__/story.tsx
  37. +1 βˆ’1 src/LocalStorage/__story__/story.tsx
  38. +1 βˆ’1 src/LocationSensor/__story__/story.tsx
  39. +1 βˆ’1 src/Mailto/__story__/story.tsx
  40. +1 βˆ’1 src/Map/__story__/story.tsx
  41. +1 βˆ’1 src/MediaDeviceSensor/__story__/story.tsx
  42. +1 βˆ’1 src/MediaSensor/__story__/story.ts
  43. +1 βˆ’1 src/Modal/__story__/story.tsx
  44. +1 βˆ’1 src/MotionSensor/__story__/story.tsx
  45. +1 βˆ’1 src/MouseSensor/__story__/story.tsx
  46. +1 βˆ’1 src/NetworkSensor/__story__/story.tsx
  47. +1 βˆ’1 src/OrientationSensor/__story__/story.tsx
  48. +1 βˆ’1 src/OutsideClick/__story__/story.tsx
  49. +4 βˆ’4 src/OutsideClick/index.ts
  50. +1 βˆ’1 src/Overlay/__story__/story.tsx
  51. +3 βˆ’3 src/Parallax/index.ts
  52. +2 βˆ’2 src/Portal/index.ts
  53. +1 βˆ’1 src/Prompt/__story__/story.tsx
  54. +4 βˆ’2 src/Prompt/index.ts
  55. +1 βˆ’1 src/Render/__story__/story.tsx
  56. +1 βˆ’1 src/RenderInterval/__story__/story.tsx
  57. +2 βˆ’2 src/Resolve/index.ts
  58. +1 βˆ’1 src/Ripple/__story__/story.tsx
  59. +5 βˆ’5 src/Ripple/index.ts
  60. +1 βˆ’1 src/ScratchSensor/__story__/story.tsx
  61. +1 βˆ’1 src/ScrollSensor/story.ts
  62. +1 βˆ’1 src/ServerOnly/__story__/story.tsx
  63. +1 βˆ’1 src/ShouldUpdate/__story__/story.tsx
  64. +1 βˆ’1 {.storybook β†’ src}/ShowDocs.ts
  65. +1 βˆ’1 src/SizeSensor/__story__/story.ts
  66. +5 βˆ’5 src/SizeSensor/index.ts
  67. +1 βˆ’1 src/Slider/__story__/story.tsx
  68. +3 βˆ’3 src/Slider/index.ts
  69. +1 βˆ’1 src/Speak/__story__/story.ts
  70. +1 βˆ’1 src/State/__story__/story.tsx
  71. +1 βˆ’1 src/Toggle/__story__/story.tsx
  72. +1 βˆ’1 src/Tween/__story__/story.tsx
  73. +1 βˆ’1 src/Value/__story__/story.tsx
  74. +1 βˆ’1 src/Vibrate/story.tsx
  75. +1 βˆ’1 src/Video/__story__/story.tsx
  76. +1 βˆ’1 src/ViewportObserverSensor/index.ts
  77. +1 βˆ’1 src/ViewportScrollSensor/index.ts
  78. +1 βˆ’1 src/ViewportSensor/__story__/story.tsx
  79. +1 βˆ’1 src/WhenIdle/__story__/story.tsx
  80. +1 βˆ’1 src/WidthQuery/__story__/story.tsx
  81. +1 βˆ’1 src/WidthSensor/__story__/story.ts
  82. +2 βˆ’2 src/WidthSensor/index.ts
  83. +1 βˆ’1 src/WindowScrollSensor/__story__/story.ts
  84. +2 βˆ’2 src/WindowScrollSensor/index.ts
  85. +1 βˆ’1 src/WindowSizeSensor/__story__/story.ts
  86. +2 βˆ’2 src/WindowSizeSensor/index.ts
  87. +1 βˆ’1 src/WindowWidthQuery/__story__/story.tsx
  88. +1 βˆ’1 src/WindowWidthSensor/__story__/story.js
  89. +1 βˆ’1 src/__story__/lazy.story.tsx
  90. +1 βˆ’1 src/__story__/loadable.story.tsx
  91. +1 βˆ’1 src/cssvars/__story__/story.tsx
  92. +1 βˆ’1 src/invert.story.tsx
  93. +2 βˆ’2 src/invert.ts
  94. +3 βˆ’3 src/route/Link.ts
  95. +1 βˆ’1 src/route/__story__/story.tsx
  96. +1 βˆ’1 src/translate/__story__/story.tsx
  97. +4 βˆ’0 src/typing.d.ts
  98. +2 βˆ’4 src/util.ts
  99. +2 βˆ’2 src/util/wrapInStatefulComponent.ts
  100. +1 βˆ’1 src/viewport.story.tsx
  101. +2 βˆ’2 src/viewport.ts
  102. +12 βˆ’21 tsconfig.json
  103. +99 βˆ’959 yarn.lock
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -7,22 +7,23 @@
"type": "git",
"url": "https://github.com/streamich/libreact.git"
},
"files": ["lib/"],
"scripts": {
"start": "npm run test:story",
"build": "npm run clean && gulp --gulpfile build/gulpfile.js build",
"clean": "rimraf lib modules && npm run test:story:clean && npm run docs:clean",
"test": "npm run test:server && npm run test:client",
"start": "yarn test:story",
"clean": "rimraf lib modules && yarn test:story:clean && yarn docs:clean",
"build": "tsc",
"test": "yarn test:server && yarn test:client",
"test:server": "mocha -r ts-node/register src/**/*.test-server.ts*",
"test:client": "jest",
"test:client:coverage": "jest --coverage",
"test:watch": "jest --watch",
"test:story:clean": "rimraf storybook-static",
"test:story": "npm run storybook",
"test:story": "yarn storybook",
"test:story:build": "build-storybook",
"docs:clean": "rimraf dist_docs docs/_book",
"docs:serve": "npm run docs:clean && gitbook install ./docs && gitbook serve ./docs",
"docs:build": "npm run docs:clean && gitbook install ./docs && gitbook build ./docs",
"docs:publish": "npm run test:story:build && npm run docs:build && ./build/publish-docs.sh",
"docs:serve": "yarn docs:clean && gitbook install ./docs && gitbook serve ./docs",
"docs:build": "yarn docs:clean && gitbook install ./docs && gitbook build ./docs",
"docs:publish": "yarn test:story:build && yarn docs:build && ./build/publish-docs.sh",
"storybook": "start-storybook -p 6007",
"semantic-release": "semantic-release"
},
@@ -47,14 +48,12 @@
"@types/chai": "4.1.1",
"@types/jest": "22.0.1",
"@types/node": "9.3.0",
"@types/react": "^16.3.17",
"@types/react-dom": "16.0.3",
"@types/react": "^16.4.14",
"@types/react-dom": "^16.0.8",
"chai": "4.1.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.4",
"gulp": "3.9.1",
"gulp-typescript": "3",
"jest": "^23.6.0",
"jest-environment-jsdom": "^23.4.0",
"jest-environment-jsdom-global": "^1.1.0",
@@ -64,10 +63,10 @@
"react-test-renderer": "16.2.0",
"rimraf": "2.6.2",
"to-string-loader": "1.1.5",
"ts-jest": "22.0.1",
"ts-loader": "3.2.0",
"ts-node": "4.1.0",
"typescript": "2.6.2",
"ts-jest": "^23.10.3",
"ts-loader": "^5.2.1",
"ts-node": "^7.0.1",
"typescript": "^3.1.1",
"webpack": "3.10.0",
"semantic-release": "^15.5.0",
"@semantic-release/changelog": "^2.0.2",
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {ActiveSensor} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Sensors/ActiveSensor', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/ActiveSensor.md')}))
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {AfterDraf} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Animation/AfterDraf', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/AfterDraf.md')}))
@@ -1,4 +1,4 @@
import {Component} from 'react';
import * as React from 'react';
import {isClient} from '../util';
export interface IAfterDrafState {
@@ -9,7 +9,7 @@ export const createSingleRunDraf = isClient
? () => {
let signelDrafFinished = false;
return class extends Component<{}, IAfterDrafState> {
return class extends React.Component<{}, IAfterDrafState> {
frame;
state: IAfterDrafState;
View
@@ -1,12 +1,12 @@
import {Component} from 'react';
import * as React from 'react';
import {isClient} from '../util';
export interface IAfterDrafState {
ready: boolean;
}
export const AfterDraf = isClient
? class AfterDraf extends Component<{}, IAfterDrafState> {
? class AfterDraf extends React.Component<{}, IAfterDrafState> {
frame;
state: IAfterDrafState;
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {AfterTimeout} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Animation/AfterTimeout', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/AfterTimeout.md')}))
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {Alert} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Generators/Alert', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/Alert.md')}))
@@ -1,7 +1,7 @@
import {Component, createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {BatterySensor, withBattery} from '..';
import ShowDocs from '../../../.storybook/ShowDocs';
import ShowDocs from '../../ShowDocs';
const Print = (props) => h('pre', {
style: {
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {BrowserOnly} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Boundaries/BrowserOnly', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/BrowserOnly.md')}))
@@ -1,7 +1,7 @@
import {Component, createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {Counter, withCounter} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
const Val = ({value, inc}) =>
<div onClick={() => inc(3)} onDoubleClick={inc}>{value}</div>;
@@ -2,7 +2,7 @@ import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {Dimmable} from '..';
import {Toggle} from '../../Toggle';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('UI/Dimmable', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/Dimmable.md')}))
View
@@ -1,5 +1,5 @@
import * as React from 'react';
import {IDimmableProps} from './index';
import {Component, Children, cloneElement} from 'react';
import {h, noop} from '../util';
import {Dimmer, IDimmerProps} from '../Dimmer';
@@ -19,15 +19,15 @@ export interface IDimmableProps extends IDimmerProps {
renderOverlay?: (dim?: boolean) => React.ReactChild;
}
export class Dimmable extends Component<IDimmableProps> {
export class Dimmable extends React.Component<IDimmableProps> {
static defaultProps = {
blur: 5,
};
render () {
const {children, dim, blur, renderOverlay, ...rest} = this.props;
const element = Children.only(children);
const elementChildren = Children.toArray(element.props.children);
const element = React.Children.only(children);
const elementChildren = React.Children.toArray(element.props.children);
let child: React.ReactChild;
const dimmerProps: IDimmerProps = rest;
@@ -65,13 +65,13 @@ export class Dimmable extends Component<IDimmableProps> {
}
}
child = cloneElement(child, childProps);
child = React.cloneElement(child, childProps);
}
} else {
child = h(onlyTextNodes(elementChildren) ? 'span' : 'div', childProps, ...elementChildren);
}
return cloneElement(element, {
return React.cloneElement(element, {
style: {
...(element.props.style || {}),
position: 'relative'
@@ -2,7 +2,7 @@ import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {Dimmer} from '..';
import {Toggle} from '../../Toggle';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('UI/Dimmer', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/Dimmer.md')}))
@@ -2,7 +2,7 @@ import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {action} from '@storybook/addon-actions';
import {DropArea} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('UI/DropArea', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/DropArea.md')}))
View
@@ -1,4 +1,4 @@
import {Component, cloneElement} from 'react';
import * as React from 'react';
import {render} from 'react-universal-interface';
import {noop} from '../util';
@@ -11,7 +11,7 @@ export interface IDropAreaProps {
export interface IDropAreaState {
}
export class DropArea extends Component<IDropAreaProps, IDropAreaState> {
export class DropArea extends React.Component<IDropAreaProps, IDropAreaState> {
static defaultProps = {
onFiles: noop,
onText: noop,
@@ -73,7 +73,7 @@ export class DropArea extends Component<IDropAreaProps, IDropAreaState> {
const element = render(this.props, {});
const {props} = element;
return cloneElement(element, {
return React.cloneElement(element, {
...props,
onDragOver: this.onDragOver(props.onDragOver),
onDragEnter: this.onDragEnter(props.onDragEnter),
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {ElectronOnly} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Boundaries/ElectronOnly', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/ElectronOnly.md')}))
@@ -1,7 +1,7 @@
import {Component, createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {ErrorBoundary, withErrorBoundary} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
class BuggyCounter extends Component<any, any> {
state;
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {ExitSensor} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
import {StoryExitSensorExample} from './StoryExitSensorExample';
storiesOf('Sensors/ExitSensor', module)
View
@@ -1,4 +1,4 @@
import {Component, cloneElement} from 'react';
import * as React from 'react';
export interface IExitSensorProps {
children?: React.ReactElement<any>;
@@ -8,7 +8,7 @@ export interface IExitSensorProps {
export interface IExitSensorState {
}
export class ExitSensor extends Component<IExitSensorProps, IExitSensorState> {
export class ExitSensor extends React.Component<IExitSensorProps, IExitSensorState> {
static defaultProps = {
time: 200
};
@@ -52,7 +52,7 @@ export class ExitSensor extends Component<IExitSensorProps, IExitSensorState> {
if (this.exitInFlight) {
this.nextElement = element;
return cloneElement(this.element, {
return React.cloneElement(this.element, {
exiting: true
});
}
@@ -69,7 +69,7 @@ export class ExitSensor extends Component<IExitSensorProps, IExitSensorState> {
this.timeout = setTimeout(this.transition, this.props.time);
return cloneElement(this.element, {
return React.cloneElement(this.element, {
exiting: true
});
}
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {Flipflop} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Inversion/Flipflop', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/Flipflop.md')}))
@@ -1,7 +1,7 @@
import {createElement as h} from 'react';
import {storiesOf} from '@storybook/react';
import {FocusSensor} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'
import ShowDocs from '../../ShowDocs'
storiesOf('Sensors/FocusSensor', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/FocusSensor.md')}))
Oops, something went wrong.

0 comments on commit c050afd

Please sign in to comment.