Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit bd16e63

Browse files
committed
Obsolete babel
1 parent 36dbec7 commit bd16e63

13 files changed

+47
-96
lines changed

.babelrc

-28
This file was deleted.

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ script:
2020
- npm run lint
2121
- npm run test
2222
- npm run test:coverage
23+
- npm run build
2324
after_success:
2425
- npm run ci:coveralls
25-
before_deploy:
26-
- npm run build
2726
deploy:
2827
provider: npm
2928
on:

gulpfile.js

+9-14
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ const jsonlint = require("gulp-jsonlint");
55
const eslint = require("gulp-eslint");
66
const merge = require("merge2");
77
const yamllint = require("gulp-yaml-validate");
8-
const babel = require("gulp-babel");
98
const sourcemaps = require("gulp-sourcemaps");
10-
const fs = require("fs");
11-
12-
const babelConfig = JSON.parse(fs.readFileSync("./.babelrc", "utf8"));
139

1410
const files = {
1511
tsWithoutTest: ["./src/**/*.ts", "./src/**/*.tsx", "!./src/**/*.spec.tsx", "!./src/**/*.spec.ts"],
1612
tsWithTest: ["./src/**/*.ts", "./src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
17-
json: ["./*.json", "./.babelrc"],
13+
json: ["./*.json"],
1814
yml: ["./*.yml"],
1915
js: ["./*.js"],
2016
};
@@ -23,30 +19,29 @@ function onBuildError() {
2319
this.once("finish", () => process.exit(1));
2420
}
2521

26-
function build(type) {
22+
function build(dest, module) {
2723
return () => {
2824
const tsProject = ts.createProject("tsconfig.json", {
2925
noEmitOnError: true,
30-
declaration: type === "lib",
31-
target: "es6",
32-
module: "es6",
26+
declaration: dest === "lib",
27+
target: "es5",
28+
module,
3329
});
3430
const tsResult = gulp.src(files.tsWithoutTest)
3531
.pipe(sourcemaps.init())
3632
.pipe(tsProject())
3733
.once("error", onBuildError);
3834
return merge([
39-
tsResult.dts.pipe(gulp.dest(type)),
35+
tsResult.dts.pipe(gulp.dest(dest)),
4036
tsResult.js
41-
.pipe(babel(babelConfig.env[`build-${type}`]))
4237
.pipe(sourcemaps.write("."))
43-
.pipe(gulp.dest(type)),
38+
.pipe(gulp.dest(dest)),
4439
]);
4540
};
4641
}
4742

48-
gulp.task("lib", ["lint"], build("lib"));
49-
gulp.task("commonjs", ["lint"], build("cjs"));
43+
gulp.task("lib", ["lint"], build("lib", "es6"));
44+
gulp.task("commonjs", ["lint"], build("cjs", "commonjs"));
5045

5146
gulp.task("tslint", () => {
5247
return gulp.src(files.tsWithTest)

karma.conf.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ const path = require("path");
22

33
module.exports = (config) => {
44
config.set({
5-
browsers: ["Chrome"], // run in Chrome
6-
singleRun: true, // just run once by default
7-
frameworks: ["mocha"], // use the mocha test framework
5+
browsers: ["Chrome"],
6+
singleRun: true,
7+
frameworks: ["mocha"],
88
files: [
9-
"tests.webpack.js", // just load this file
9+
"tests.webpack.js",
1010
],
1111
preprocessors: {
12-
"tests.webpack.js": ["webpack", "sourcemap"], // preprocess with webpack and our sourcemap loader
12+
"tests.webpack.js": ["webpack", "sourcemap"],
1313
},
1414
remapCoverageReporter: {
1515
"text-summary": null,
@@ -23,7 +23,7 @@ module.exports = (config) => {
2323
},
2424
// TODO: enable coverage after https://github.com/deepsweet/istanbul-instrumenter-loader/pull/29.
2525
reporters: ["dots"], // , "coverage", "remap-coverage"], // report results in this format
26-
webpack: { // kind of a copy of your webpack config
26+
webpack: {
2727
resolve: {
2828
extensions: [".tsx", ".ts", ".js", ".json"],
2929
},
@@ -33,7 +33,7 @@ module.exports = (config) => {
3333
"react/lib/ExecutionEnvironment": true,
3434
"react/lib/ReactContext": true,
3535
},
36-
devtool: "inline-source-map", // just do inline source maps instead of the default
36+
devtool: "inline-source-map",
3737
module: {
3838
rules: [
3939
{
@@ -45,8 +45,6 @@ module.exports = (config) => {
4545
loader: "awesome-typescript",
4646
query: {
4747
sourceMap: true,
48-
useBabel: true,
49-
useCache: false,
5048
module: "commonjs",
5149
},
5250
},

mocha.opts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--compilers tsx:ts-babel-node/register,ts:ts-babel-node/register
1+
--compilers tsx:ts-node/register,ts:ts-node/register
22
--reporter dot
33
src/**/*.spec.tsx
44
src/**/*.spec.ts

package.json

+10-11
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
"clean": "rm -r -f dist",
2323
"ci:coveralls": "cat coverage/lcov.info | coveralls",
2424
"lint": "gulp lint",
25-
"test": "cross-env NODE_ENV=test karma start",
26-
"test:coverage": "cross-env NODE_ENV=coverage TS_NODE_PROJECT=./tsconfig.coverage.json nyc mocha --opts mocha.opts",
27-
"test:watch": "cross-env NODE_ENV=test karma start --single-run=false"
25+
"test": "npm run test:unit && npm run test:integration",
26+
"test:unit": "cross-env TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha --opts mocha.opts",
27+
"test:unit:watch": "cross-env TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' mocha --opts mocha.opts --watch",
28+
"test:integration": "cross-env NODE_ENV=test karma start",
29+
"test:integration:watch": "cross-env NODE_ENV=test karma start --single-run=false",
30+
"test:coverage": "cross-env NODE_ENV=test TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --instrument mocha --opts mocha.opts"
2831
},
2932
"engines": {
3033
"node": ">=4"
@@ -49,15 +52,11 @@
4952
"@types/enzyme": "^2.5.37",
5053
"@types/jsdom": "^2.0.29",
5154
"@types/mocha": "^2.2.32",
55+
"@types/object-assign": "^4.0.30",
5256
"@types/react": "^0.14.43",
57+
"@types/rewire": "^2.5.27",
5358
"@types/sinon": "^1.16.31",
5459
"awesome-typescript-loader": "^2.2.4",
55-
"babel-core": "^6.18.2",
56-
"babel-plugin-istanbul": "^2.0.3",
57-
"babel-plugin-rewire": "^1.0.0",
58-
"babel-plugin-transform-object-assign": "^6.8.0",
59-
"babel-preset-es2015": "^6.18.0",
60-
"babel-preset-react": "^6.16.0",
6160
"cash-rm": "^0.2.0",
6261
"chai": "^3.5.0",
6362
"coveralls": "^2.11.14",
@@ -67,13 +66,13 @@
6766
"eslint-config-airbnb-base": "^9.0.0",
6867
"eslint-plugin-import": "^2.0.1",
6968
"gulp": "^3.9.1",
70-
"gulp-babel": "^6.1.2",
7169
"gulp-eslint": "^3.0.1",
7270
"gulp-jsonlint": "^1.1.2",
7371
"gulp-sourcemaps": "^2.2.0",
7472
"gulp-tslint": "^6.1.2",
7573
"gulp-typescript": "^3.0.2",
7674
"gulp-yaml-validate": "^1.0.2",
75+
"istanbul": "^1.1.0-alpha.1",
7776
"istanbul-instrumenter-loader": "^1.0.0",
7877
"jsdom": "^9.8.0",
7978
"json-loader": "^0.5.4",
@@ -88,12 +87,12 @@
8887
"merge2": "^1.0.2",
8988
"mocha": "^3.1.2",
9089
"nyc": "^8.4.0",
90+
"object-assign": "^4.1.0",
9191
"react": "^15.3.2",
9292
"react-addons-test-utils": "^15.3.2",
9393
"react-dom": "^15.3.2",
9494
"rewire": "^2.5.2",
9595
"sinon": "^2.0.0-pre.2",
96-
"ts-babel-node": "git+https://git@github.com/danielmoore/ts-babel-node.git",
9796
"ts-node": "~1.2.3",
9897
"tslint": "^3.15.1",
9998
"typescript": "^2.0.6",

src/csstransition.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import * as React from "react";
10+
import * as objectAssign from "object-assign";
1011

1112
import { TransitionObserver, TransitionObserverProps } from "./transitionobserver";
1213

@@ -41,7 +42,7 @@ export interface CSSTransitionState {
4142
}
4243

4344
function getRest(props: CSSTransitionProps): any {
44-
const rest = Object.assign({}, props);
45+
const rest = objectAssign({}, props);
4546
delete rest.active;
4647
delete rest.transitionAppear;
4748
delete rest.onTransitionComplete;

src/processstyle.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* of the MIT license. See the LICENSE file for details.
77
*/
88

9+
import * as objectAssign from "object-assign";
10+
911
import { CSSProperties } from "react";
1012

1113
import { TransitionConfig } from "./transit";
@@ -20,7 +22,7 @@ export interface ProcessResult {
2022

2123
export function processStyle(style: CSSProperties): ProcessResult {
2224
let transition = "";
23-
let processedStyle = Object.assign({}, style);
25+
let processedStyle = objectAssign({}, style);
2426
let lastProperty: string;
2527
let lastPropertyDuration = -1;
2628
let firstPropertyDelay = 9999999999;

src/transit.spec.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,29 @@
88

99
/* tslint:disable: variable-name */
1010

11-
declare module "./transit" {
12-
export const __RewireAPI__: any;
13-
}
14-
11+
import * as rewire from "rewire";
1512
import { assert } from "chai";
16-
import { TransitionConfig, transit, __RewireAPI__ as transitRewireAPI } from "./transit";
13+
14+
import * as transitModule from "./transit";
15+
import { TransitionConfig } from "./transit";
16+
17+
const rewireModule = rewire("./transit");
18+
const { transit } = rewireModule as any as typeof transitModule;
1719

1820
describe("transit.ts", () => {
1921
let warning: string;
22+
let resetRewire: Function;
2023

2124
beforeEach(() => {
22-
transitRewireAPI.__Rewire__("warning", (condition: any, message: string) => {
25+
resetRewire = rewireModule.__set__("warning", (condition: any, message: string) => {
2326
if (!condition) {
2427
warning = message;
2528
}
2629
});
2730
});
2831

2932
afterEach(() => {
30-
transitRewireAPI.__ResetDependency__("warning");
33+
resetRewire();
3134
warning = undefined;
3235
});
3336

src/transitionobserver.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import * as React from "react";
10+
import * as objectAssign from "object-assign";
1011

1112
import { processStyle } from "./processstyle";
1213
import { matchTransitionProperty } from "./utils";
@@ -19,7 +20,7 @@ export interface TransitionObserverProps {
1920
}
2021

2122
function getRest(props: TransitionObserverProps): any {
22-
const rest = Object.assign({}, props);
23+
const rest = objectAssign({}, props);
2324
delete rest.style;
2425
delete rest.onTransitionBegin;
2526
delete rest.onTransitionComplete;

tests.webpack.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
const unitContext = require.context("./src", true, /\.tsx?$/);
2-
unitContext.keys().forEach(unitContext);
3-
41
const integrationContext = require.context("./test", true, /\.tsx?$/);
52
integrationContext.keys().forEach(integrationContext);

tsconfig.coverage.json

-16
This file was deleted.

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
3+
"target": "es5",
44
"module": "es6",
55
"moduleResolution": "node",
6-
"jsx": "preserve",
6+
"jsx": "react",
77
"noImplicitAny": true,
88
"baseUrl": "./",
99
"paths": {

0 commit comments

Comments
 (0)