Skip to content

Commit a3e0332

Browse files
authored
Merge pull request reactjs#1 from diasbruno/fix/compilation
Fix compilation.
2 parents 965a2c3 + 2fc1382 commit a3e0332

File tree

4 files changed

+24
-42
lines changed

4 files changed

+24
-42
lines changed

.babelrc

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
11
{
2-
"presets": ["react"],
3-
"env": {
4-
"commonjs": {
5-
"plugins": [
6-
"transform-class-properties",
7-
"transform-object-rest-spread"
8-
],
9-
"presets": ["env"]
10-
},
11-
"es": {
12-
"plugins": [
13-
"transform-class-properties",
14-
"transform-object-rest-spread"
15-
],
16-
"presets": [
17-
["env", { "modules": false }]
18-
]
19-
}
20-
}
2+
"presets": ["es2015", "stage-2", "react"]
213
}

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ docs: build-docs
6868

6969
# Rules for build and publish
7070

71-
build:
71+
compile:
72+
@echo "[Compiling source]"
73+
babel src --out-dir lib
74+
75+
build: compile
7276
@echo "[Building dists]"
7377
@./node_modules/.bin/webpack --config webpack.dist.config.js
7478

@@ -120,5 +124,8 @@ publish-docs: deps-docs build-docs
120124

121125
publish-all: publish publish-docs
122126

123-
clean:
127+
clean-sources:
128+
@rm -rf lib/* dist/* _book
129+
130+
clean: clean-sources
124131
@rm -rf .version .branch ./coverage/*

package.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"version": "2.0.0",
44
"description": "Accessible modal dialog component for React.JS",
55
"main": "./lib/index.js",
6-
"module": "./es/index.js",
7-
"jsnext:main": "./es/index.js",
86
"repository": {
97
"type": "git",
108
"url": "https://github.com/reactjs/react-modal.git"
@@ -16,12 +14,8 @@
1614
},
1715
"scripts": {
1816
"start": "./node_modules/.bin/webpack-dev-server --inline --host 127.0.0.1 --content-base examples/",
19-
"test": "cross-env BABEL_ENV=commonjs NODE_ENV=test karma start",
20-
"lint": "eslint lib/",
21-
"clean": "rimraf lib es",
22-
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
23-
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
24-
"build": "npm run clean && npm run build:commonjs && npm run build:es"
17+
"test": "cross-env NODE_ENV=test karma start",
18+
"lint": "eslint lib/"
2519
},
2620
"authors": [
2721
"Ryan Florence"
@@ -32,10 +26,9 @@
3226
"babel-core": "^6.25.0",
3327
"babel-eslint": "^7.1.1",
3428
"babel-loader": "^6.2.4",
35-
"babel-plugin-transform-class-properties": "^6.24.1",
36-
"babel-plugin-transform-object-rest-spread": "^6.23.0",
37-
"babel-preset-env": "^1.5.2",
29+
"babel-preset-es2015": "^6.24.1",
3830
"babel-preset-react": "^6.24.1",
31+
"babel-preset-stage-2": "^6.24.1",
3932
"codeclimate-test-reporter": "^0.4.0",
4033
"coveralls": "^2.13.1",
4134
"cross-env": "^5.0.1",

specs/Modal.spec.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import expect from 'expect';
33
import React, { Component } from 'react';
44
import ReactDOM from 'react-dom';
55
import TestUtils from 'react-addons-test-utils';
6-
import createReactClass from 'create-react-class';
76
import Modal from '../src/components/Modal';
87
import * as ariaAppHider from '../src/helpers/ariaAppHider';
98
import {
@@ -57,7 +56,7 @@ describe('State', () => {
5756

5857
it('renders into the body, not in context', () => {
5958
const node = document.createElement('div');
60-
const App = createReactClass({
59+
class App extends Component {
6160
render() {
6261
return (
6362
<div>
@@ -67,7 +66,7 @@ describe('State', () => {
6766
</div>
6867
);
6968
}
70-
});
69+
}
7170
Modal.setAppElement(node);
7271
ReactDOM.render(<App />, node);
7372
expect(
@@ -357,22 +356,23 @@ describe('State', () => {
357356
const node = document.createElement('div');
358357
let modal = null;
359358

360-
const App = createReactClass({
361-
getInitialState() {
362-
return { testHasChanged: false };
363-
},
359+
class App extends Component {
360+
constructor(props) {
361+
super(props);
362+
this.state = { testHasChanged: false };
363+
}
364364

365365
componentDidMount() {
366366
expect(modal.node.className).toEqual('myPortalClass');
367367

368368
this.setState({
369369
testHasChanged: true
370370
});
371-
},
371+
}
372372

373373
componentDidUpdate() {
374374
expect(modal.node.className).toEqual('myPortalClass-modifier');
375-
},
375+
}
376376

377377
render() {
378378
const portalClassName = this.state.testHasChanged === true ?
@@ -389,7 +389,7 @@ describe('State', () => {
389389
</div>
390390
);
391391
}
392-
});
392+
}
393393

394394
Modal.setAppElement(node);
395395
ReactDOM.render(<App />, node);

0 commit comments

Comments
 (0)