Skip to content

Commit bcc1a80

Browse files
committed
feat: 🎸 update build process
Use tsc to compile, remove gulp, update dependencies.
1 parent 606d4c4 commit bcc1a80

10 files changed

+46
-82
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ yarn.lock
1212
/dist_docs/
1313
_book/
1414
/storybook-static/
15+
yarn-error.log

build/gulpfile.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,50 @@
33
"version": "0.0.1",
44
"description": "Universal Children Definition for React Components",
55
"main": "lib/index.js",
6+
"types": "lib/index.d.ts",
7+
"typings": "lib/index.d.ts",
68
"repository": {
79
"type": "git",
810
"url": "https://github.com/streamich/react-universal-interface.git"
911
},
1012
"scripts": {
11-
"build": "npm run clean && gulp --gulpfile build/gulpfile.js build-ts && gulp --gulpfile build/gulpfile.js build-modules",
12-
"clean": "rimraf lib modules",
13+
"build": "npm run clean && tsc",
14+
"clean": "rimraf lib",
1315
"test": "npm run test:server && npm run test:client",
1416
"test:server": "mocha -r ts-node/register src/**/*.test-server.ts*",
1517
"test:client": "jest",
16-
"test:client:coverage": "jest --coverage",
17-
"test:watch": "jest --watch",
1818
"semantic-release": "semantic-release"
1919
},
2020
"dependencies": {
21+
"tslib": "^1.9.3"
2122
},
2223
"peerDependencies": {
2324
"react": "*"
2425
},
2526
"devDependencies": {
26-
"@types/chai": "4.1.1",
27-
"@types/jest": "22.0.1",
28-
"@types/node": "9.3.0",
29-
"@types/react": "16.0.36",
30-
"@types/react-dom": "16.0.4",
27+
"@types/chai": "^4.1.6",
28+
"@types/jest": "^23.3.5",
29+
"@types/node": "^10.12.0",
30+
"@types/react": "^16.4.18",
31+
"@types/react-dom": "^16.0.9",
3132
"chai": "4.1.2",
3233
"enzyme": "3.3.0",
3334
"enzyme-adapter-react-16": "^1.1.1",
3435
"enzyme-to-json": "3.3.0",
35-
"gulp": "3.9.1",
36-
"gulp-typescript": "3",
3736
"jest": "22.1.2",
3837
"jest-environment-jsdom": "^22.1.4",
3938
"jest-environment-jsdom-global": "^1.0.3",
4039
"jest-tap-reporter": "1.9.0",
4140
"mocha": "5.0.0",
4241
"mol-conventional-changelog": "1.2.0",
4342
"react-test-renderer": "16.2.0",
44-
"rimraf": "2.6.2",
45-
"ts-jest": "22.0.1",
46-
"ts-node": "4.1.0",
47-
"typescript": "2.6.2",
48-
"semantic-release": "^12.2.4",
49-
"react": "^16.2.0",
50-
"react-dom": "^16.2.0"
43+
"rimraf": "^2.6.2",
44+
"ts-jest": "^23.10.4",
45+
"ts-node": "^7.0.1",
46+
"typescript": "^3.1.3",
47+
"semantic-release": "^15.10.4",
48+
"react": "^16.5.2",
49+
"react-dom": "^16.5.2"
5150
},
5251
"config": {
5352
"commitizen": {
@@ -72,7 +71,8 @@
7271
"reporters": [
7372
"jest-tap-reporter"
7473
],
75-
"testEnvironment": "jest-environment-jsdom-global"
74+
"testEnvironment": "jest-environment-jsdom-global",
75+
"testURL": "http://localhost"
7676
},
7777
"keywords": [
7878
"react",

src/__tests__/createEnhancer.test-server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {createElement as h} from 'react';
1+
import * as React from 'react';
22
import {renderToString} from 'react-dom/server';
33
import {expect} from 'chai';
44
import render from '../render';

src/__tests__/createEnhancer.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {createElement as h, Component} from 'react';
1+
import * as React from 'react';
22
import render from '../render';
33
import createEnhancer from '../createEnhancer';
44
import {mount} from 'enzyme';
@@ -7,22 +7,22 @@ const Parent = (props) => render(props, {foo: 'bar' + (props.extra || '')});
77
const withParent = createEnhancer(Parent, 'parent');
88

99
@withParent
10-
class Decorator1 extends Component<any, any> {
10+
class Decorator1 extends React.Component<any, any> {
1111
render () {
1212
return <div>{this.props.parent.foo}</div>;
1313
}
1414
}
1515

1616
@withParent('custom')
17-
class Decorator2 extends Component<any, any> {
17+
class Decorator2 extends React.Component<any, any> {
1818
render () {
1919
return <div>{this.props.custom.foo}</div>;
2020
}
2121
}
2222

2323

2424
@withParent('', {extra: '.extra'})
25-
class Decorator3 extends Component<any, any> {
25+
class Decorator3 extends React.Component<any, any> {
2626
render () {
2727
return <div>{this.props.parent.foo}</div>;
2828
}

src/__tests__/render.test-server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {createElement as h} from 'react';
1+
import * as React from 'react';
22
import {renderToString} from 'react-dom/server';
33
import {expect} from 'chai';
44
import render from '../render';

src/__tests__/render.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {createElement as h} from 'react';
1+
import * as React from 'react';
22
import render from '../render';
33
import {mount} from 'enzyme';
44

src/createEnhancer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import {createElement as h} from 'react';
1+
import * as React from 'react';
22
import addClassDecoratorSupport from './addClassDecoratorSupport';
33

4+
const h = React.createElement;
5+
46
const noWrap = (Comp, propName, props, state) => h(Comp, propName ?
57
{[propName]: state, ...props} :
68
{...state, ...props}

src/wrapInStatefulComponent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {Component} from 'react';
1+
import * as React from 'react';
22

33
const wrapInStatefulComponent = (Comp) => {
4-
const Decorated = class extends Component<any, any> {
4+
const Decorated = class extends React.Component<any, any> {
55
render () {
66
return Comp(this.props, this.context);
77
}

tsconfig.json

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,30 @@
55
"moduleResolution": "Node",
66
"removeComments": true,
77
"noImplicitAny": false,
8-
"sourceMap": false,
98
"outDir": "./lib",
10-
"allowJs": true,
9+
"allowJs": false,
1110
"allowSyntheticDefaultImports": true,
1211
"jsx": "react",
13-
"jsxFactory": "h",
1412
"skipDefaultLibCheck": true,
1513
"skipLibCheck": true,
1614
"experimentalDecorators": true,
17-
"lib": [
18-
"dom",
19-
"es5",
20-
"es6",
21-
"es7",
22-
"es2015",
23-
"scripthost",
24-
"dom.iterable"
25-
]
15+
"importHelpers": true,
16+
"pretty": true,
17+
"sourceMap": true,
18+
"esModuleInterop": true,
19+
"noEmitHelpers": true,
20+
"noErrorTruncation": true,
21+
"noFallthroughCasesInSwitch": true,
22+
"noImplicitReturns": true,
23+
"declaration": true,
24+
"lib": ["dom", "es5", "es6", "es7", "es2015", "es2017", "scripthost", "dom.iterable"]
2625
},
27-
"include": [
28-
"src"
29-
],
26+
"include": ["typing.d.ts", "src"],
3027
"exclude": [
3128
"node_modules",
3229
"lib",
33-
"src/__tests__",
30+
"**/__tests__/**/*",
3431
"*.test.ts",
35-
"*.test.tsx",
36-
"*.test-server.ts",
37-
"*.test-server.tsx"
32+
"*.test.tsx"
3833
]
3934
}

0 commit comments

Comments
 (0)