Skip to content

Commit

Permalink
refactor: consider react and prop types as peer deps (#6)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: *consider react and prop-types as peerDeps*
  - might affect the published dist
  • Loading branch information
douglasduteil committed Sep 11, 2019
1 parent a9a21e5 commit 205b2f5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Test:
script:
- yarn test

Lint:
stage: Test
script:
- yarn lint

Pages:
stage: "Release"
script:
Expand Down
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"README.md",
"dist"
],
"dependencies": {
"react-svgmt": "^1.1.8"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
Expand All @@ -20,16 +23,19 @@
"jest": "^24.8.0",
"parcel-bundler": "^1.10",
"prettier": "^1.18.2",
"react-test-renderer": "^16.8.6"
},
"dependencies": {
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react": "^16.9.0",
"react-dom": "^16.8.6",
"react-svgmt": "^1.1.8"
"react-test-renderer": "^16.8.6"
},
"peerDependencies": {
"prop-types": "15.x",
"react": "16.x",
"react-dom": "16.x"
},
"scripts": {
"test": "jest",
"lint": "eslint src",
"clean": "rm -rf ./dist",
"clean:demo": "rm -rf ./example/dist",
"start": "parcel watch ./src/index.js --out-dir ./dist",
Expand Down
17 changes: 12 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import PropTypes from "prop-types";
import { SvgLoader, SvgProxy } from "react-svgmt";

import Carte from "./Carte";
Expand All @@ -14,9 +15,12 @@ const normalizeDpt = dpt => {
};

const France = ({ color, highlightColor, departements }) => {

const dpts = [...departements];
if (["75", "92", "93", "94"].filter(dpt => departements.map(d => d.toString()).includes(dpt)).length === 4) {
if (
["75", "92", "93", "94"].filter(dpt =>
departements.map(d => d.toString()).includes(dpt)
).length === 4
) {
dpts.push("75-92-93-94");
}
return (
Expand All @@ -31,10 +35,13 @@ const France = ({ color, highlightColor, departements }) => {
))}
</SvgLoader>
);
};

}

France.propTypes = {};
France.propTypes = {
color: PropTypes.string,
departements: PropTypes.array,
highlightColor: PropTypes.string
};

France.defaultProps = {
color: "#74B4FF",
Expand Down
9 changes: 4 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6246,15 +6246,14 @@ react-test-renderer@^16.8.6:
react-is "^16.8.6"
scheduler "^0.13.6"

react@^16.8.6:
version "16.8.6"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe"
integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==
react@^16.9.0:
version "16.9.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa"
integrity sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.13.6"

read-pkg-up@^2.0.0:
version "2.0.0"
Expand Down

0 comments on commit 205b2f5

Please sign in to comment.