Skip to content

Commit

Permalink
Merge pull request #16 from formatlos/hotfix-15
Browse files Browse the repository at this point in the history
make jsonfile dependency optional
  • Loading branch information
joetidee authored Aug 15, 2018
2 parents 9f0dcd0 + d195f33 commit 8586b90
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
37 changes: 19 additions & 18 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
"lib/"
],
"module": "lib/",
"dependencies": {
"jsonfile": "^4.0.0"
},
"dependencies": {},
"peerDependencies": {
"enzyme": "^2.7.1 || ^3.3.0",
"react": "^15.5.0 || ^16.0.0",
"react-dom": "^15.5.0 || ^16.0.0",
"react-intl": "^2.2.3"
},
"optionalDependencies": {
"jsonfile": "^4.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.44",
"@babel/core": "^7.0.0-beta.44",
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { IntlProvider, intlShape } from 'react-intl';
import { mount, shallow, render } from 'enzyme';
import jsonfile from 'jsonfile';
let path = require('path');
let locale = 'en';
let messages = {};
Expand All @@ -17,7 +16,7 @@ function loadTranslation(localeFilePath) {
return null;
}
let fp = path.join(__dirname, localeFilePath);
messages = jsonfile.readFileSync("." + fp);
messages = require('jsonfile').readFileSync("." + fp);
return messages;
}

Expand Down

0 comments on commit 8586b90

Please sign in to comment.