Skip to content

Commit

Permalink
fix(PropTypes): Revert to React core, not prop-types or build will break
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoGentile committed May 5, 2017
1 parent 23528ad commit 812b689
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
9 changes: 9 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
]
],
"plugins": [
["transform-react-remove-prop-types", {
"mode": "remove",
"removeImport": true
}],
"transform-decorators-legacy",
"transform-runtime"
]
Expand Down
12 changes: 6 additions & 6 deletions src/modules/BaseLink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import React, { Component, PropTypes } from 'react';
// import PropTypes from 'prop-types';
import { ifNot } from './utils';

// TODO
Expand Down Expand Up @@ -113,9 +113,9 @@ BaseLink.propTypes = {
// Optional
// these are received if component is wrapped with `withRoute` or `withLink` HOCs
//===============================================================================
BaseLink.propTypes[storeName] = PropTypes.object;
BaseLink.propTypes['route'] = PropTypes.object;
BaseLink.propTypes['previousRoute'] = PropTypes.object;
BaseLink.propTypes['isActive'] = PropTypes.bool;
BaseLink.propTypes[storeName] /* remove-proptypes */ = PropTypes.object;
BaseLink.propTypes['route'] /* remove-proptypes */ = PropTypes.object;
BaseLink.propTypes['previousRoute'] /* remove-proptypes */ = PropTypes.object;
BaseLink.propTypes['isActive'] /* remove-proptypes */ = PropTypes.bool;

export default BaseLink;
8 changes: 4 additions & 4 deletions src/modules/routeNode.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, createElement } from 'react';
import PropTypes from 'prop-types';
import { Component, createElement, PropTypes } from 'react';
// import PropTypes from 'prop-types';
import { getDisplayName, ifNot } from './utils';
import { autorun } from 'mobx';
import { inject } from 'mobx-react';
Expand Down Expand Up @@ -59,8 +59,8 @@ function routeNode(nodeName, storeName = 'routerStore') { // route node Name, ro
RouteNode.displayName = 'RouteNode[' + getDisplayName(RouteSegment) + ']';

// Because @inject creates an extra HOC
RouteNode.wrappedComponent.propTypes = {};
RouteNode.wrappedComponent.propTypes[storeName] = PropTypes.object.isRequired;
RouteNode.wrappedComponent.propTypes /* remove-proptypes */ = {};
RouteNode.wrappedComponent.propTypes[storeName] /* remove-proptypes */ = PropTypes.object.isRequired;

return RouteNode;
};
Expand Down
4 changes: 2 additions & 2 deletions src/modules/withLink.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import React, { PropTypes } from 'react';
// import PropTypes from 'prop-types';
import BaseLink from './BaseLink';
import withRoute from './withRoute';

Expand Down
4 changes: 2 additions & 2 deletions src/modules/withRoute.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import React, { Component, PropTypes } from 'react';
// import PropTypes from 'prop-types';
import { inject, observer } from 'mobx-react';
import { ifNot, getDisplayName } from './utils';

Expand Down
9 changes: 3 additions & 6 deletions tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ promise = promise.then(() => del(['dist/*']));

// Compile source code into a distributable format with Babel
['es', 'cjs', 'umd'].forEach((format) => {
console.log(Object.assign(pkg.babel, {
babelrc: false,
exclude: 'node_modules/**',
runtimeHelpers: true
}));

promise = promise.then(() => rollup.rollup({
entry: 'src/index.js',
external: Object.keys(pkg.dependencies),
Expand All @@ -37,7 +33,8 @@ promise = promise.then(() => del(['dist/*']));
runtimeHelpers: true, // because we use transform-runtime plugin (avoid repetition)
}))
]
}).then(bundle => bundle.write({
})
.then(bundle => bundle.write({
dest: `dist/${format === 'cjs' ? 'index' : `index.${format}`}.js`,
format,
sourceMap: true,
Expand Down

0 comments on commit 812b689

Please sign in to comment.