Skip to content

Commit

Permalink
Merge eb0eae4 into 58da94c
Browse files Browse the repository at this point in the history
  • Loading branch information
rjerue committed Apr 29, 2019
2 parents 58da94c + eb0eae4 commit e991d4c
Show file tree
Hide file tree
Showing 7 changed files with 1,369 additions and 5,373 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -52,3 +52,5 @@ buck-out/
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots

lib
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- "11"
- 'stable'
after_script:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
10 changes: 8 additions & 2 deletions babel.config.js
@@ -1,3 +1,9 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
module.exports = (api) => {
const preset = api.env('test')
? 'module:metro-react-native-babel-preset'
: ['@babel/preset-env', { modules: false }];

return {
presets: ['@babel/preset-react', preset],
};
};
7 changes: 7 additions & 0 deletions index.js
@@ -0,0 +1,7 @@
/* eslint-disable import/no-unresolved */
/* eslint-disable global-require */
if (process.env.NODE_ENV === 'production') {
module.exports = require('./lib/prod');
} else {
module.exports = require('./lib/dev');
}
41 changes: 29 additions & 12 deletions package.json
Expand Up @@ -21,7 +21,11 @@
"format": "prettier-eslint --write \"src/**/*.js\" && prettier-eslint --write \"Example/components/**/*.js\"",
"lint": "eslint ./src",
"test": "./node_modules/.bin/jest --coverage --no-cache",
"test:auto": "./node_modules/.bin/jest --watch"
"test:auto": "./node_modules/.bin/jest --watch",
"build:prod": "NODE_ENV=production rollup -c",
"build:dev": "NODE_ENV=development rollup -c",
"prepublishOnly": "npm run release",
"release": "npm run build:dev && npm run build:prod"
},
"husky": {
"hooks": {
Expand All @@ -31,9 +35,15 @@
"dependencies": {
"prop-types": "15.6.2"
},
"peerDependencies": {
"react": "^16.8.6"
},
"devDependencies": {
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "24.1.0",
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.4.4",
"babel-jest": "^24.4.0",
"coveralls": "2.13.1",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.10.0",
Expand All @@ -44,25 +54,32 @@
"eslint-plugin-jsx-a11y": "6.1.1",
"eslint-plugin-react": "7.11.1",
"husky": "^2.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.52.0",
"jest": "^24.4.0",
"metro-react-native-babel-preset": "^0.53.0",
"prettier": "1.14.2",
"prettier-eslint-cli": "4.7.1",
"react": "16.6.3",
"react-dom": "16.8.3",
"react-native": "0.58.5",
"react-test-renderer": "16.6.3"
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-native": "^0.59.5",
"react-test-renderer": "16.4.2",
"rollup": "^1.6.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-replace": "^2.1.0"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./setup/test.setup.js"
],
"modulePathIgnorePatterns": [
"<rootDir>/Example/"
"testPathIgnorePatterns": [
"<rootDir>/index.js",
"<rootDir>/node_modules/",
"<rootDir>/lib/"
],
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
}
}
}
28 changes: 28 additions & 0 deletions rollup.config.js
@@ -0,0 +1,28 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';

const NODE_ENV = process.env.NODE_ENV || 'development';
const outputFile = NODE_ENV === 'production' ? './lib/prod.js' : './lib/dev.js';

export default {
input: './src/index.js',
output: {
file: outputFile,
format: 'cjs',
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
}),
babel({
exclude: 'node_modules/**',
babelrc: false,
presets: [['@babel/preset-env', { modules: false }], '@babel/preset-react'],
}),
resolve(),
commonjs(),
],
external: id => /^react/.test(id),
};

0 comments on commit e991d4c

Please sign in to comment.