Skip to content

Commit

Permalink
Update bundling scheme (#347)
Browse files Browse the repository at this point in the history
* Update bundling scheme

This commit sets things up to work properly when
publishing to npm.  Prior to publishing the package
items from the src/ folder will be processed with Babel
and stored in the lib/ folder. The lib/ folder will
not be present in the repository.  The src/ folder similarly
will not be available when looking at the installed package.

In addition this commit also fixes #332 by adding the
`babel-plugin-transform-object-assign` plugin and removing
`lodash.assign`

* Update linting dependencies

This temporarily disables react/require-default-props
until it can be addressed in a separate commit.

* Make sure tests run using the proper source
  • Loading branch information
claydiffrient committed Mar 24, 2017
1 parent 37a6ceb commit 9cb8441
Show file tree
Hide file tree
Showing 16 changed files with 954 additions and 981 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["react", "latest", "stage-2"]
"presets": ["react", "latest", "stage-2"],
"plugins": ["babel-plugin-transform-object-assign"]
}
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
"no-plusplus": [0],
"space-before-function-paren": [2, "always"],
"import/no-extraneous-dependencies": [2, {"devDependencies": true}],
"react/jsx-filename-extension": ["error", {"extensions": [".js"]}]
"react/jsx-filename-extension": ["error", {"extensions": [".js"]}],
"react/require-default-props": [0]
},
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
.idea/
_book
coverage
lib
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ karma.conf.js
script
specs
.idea/
src
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,31 @@
"docs:build": "gitbook build -g reactjs/react-modal",
"docs:build:watch": "gitbook serve",
"docs:publish": "cd _book && git init && git commit --allow-empty -m 'update book' && git checkout -b gh-pages && touch .nojekyll && git add . && git commit -am 'update book' && git push git@github.com:reactjs/react-modal gh-pages --force",
"lint": "eslint lib/ specs/"
"lint": "eslint src/ specs/",
"prepublish": "babel src -d lib"
},
"authors": [
"Ryan Florence"
],
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-core": "^6.7.4",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.4",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.18.0",
"codeclimate-test-reporter": "^0.4.0",
"coveralls": "^2.11.15",
"envify": "^3.4.1",
"eslint": "^3.9.1",
"eslint-config-airbnb": "latest",
"eslint-plugin-import": "^2.1.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.6.0",
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^3.0.2 || ^4.0.0",
"eslint-plugin-react": "^6.9.0",
"expect": "1.10.0",
"gitbook-cli": "^2.3.0",
"istanbul-instrumenter-loader": "0.2.0",
Expand Down Expand Up @@ -72,8 +75,7 @@
},
"dependencies": {
"element-class": "^0.2.0",
"exenv": "1.2.0",
"lodash.assign": "^4.2.0"
"exenv": "1.2.0"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0",
Expand Down
4 changes: 2 additions & 2 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import React from 'react';
import sinon from 'sinon';
import expect from 'expect';
import ReactDOM from 'react-dom';
import Modal from '../lib/components/Modal';
import * as ariaAppHider from '../lib/helpers/ariaAppHider';
import Modal from '../src/components/Modal';
import * as ariaAppHider from '../src/helpers/ariaAppHider';
import { renderModal, unmountModal, emptyDOM } from './helper';

const Simulate = TestUtils.Simulate;
Expand Down
2 changes: 1 addition & 1 deletion specs/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint react/no-render-return-value: "warn" */
import React from 'react';
import ReactDOM from 'react-dom';
import Modal from '../lib/components/Modal';
import Modal from '../src/components/Modal';

const divStack = [];

Expand Down
2 changes: 1 addition & 1 deletion specs/spec_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ testsContext.keys().forEach((path) => {
}
});

const componentsContext = require.context('../lib', true, /\.js$/);
const componentsContext = require.context('../src', true, /\.js$/);
componentsContext.keys().forEach((path) => {
try {
componentsContext(path);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component, PropTypes } from 'react';
import Assign from 'lodash.assign';
import scopeTab from '../helpers/scopeTab';
import {
returnFocus,
Expand Down Expand Up @@ -211,12 +210,12 @@ export default class ModalPortal extends Component {
<div
ref={(c) => { this.overlay = c; }}
className={this.buildClassName('overlay', this.props.overlayClassName)}
style={Assign({}, overlayStyles, this.props.style.overlay || {})}
style={Object.assign({}, overlayStyles, this.props.style.overlay || {})}
onClick={this.handleOverlayOnClick}
>
<div
ref={(c) => { this.content = c; }}
style={Assign({}, contentStyles, this.props.style.content || {})}
style={Object.assign({}, contentStyles, this.props.style.content || {})}
className={this.buildClassName('content', this.props.className)}
tabIndex={-1}
onKeyDown={this.handleKeyDown}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9cb8441

Please sign in to comment.