Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 71 additions & 14 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,46 +1,103 @@
{
"env": {
"build": {
"presets": [["env", { "modules": false }], "stage-3", "react"],
"plugins": ["external-helpers", "transform-class-properties"],
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-json-strings"
],
"ignore": [
"*.test.js"
]
},
"buildProd": {
"presets": [["env", { "modules": false }], "stage-3", "react"],
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": [
"external-helpers",
"transform-class-properties",
"@babel/plugin-proposal-class-properties",
[
"transform-react-remove-prop-types",
{ "mode": "remove", "removeImport": true }
]
{
"mode": "remove",
"removeImport": true
}
],
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-json-strings"
],
"ignore": [
"*.test.js"
]
},
"es": {
"presets": [["env", { "modules": false }], "stage-3", "react"],
"plugins": ["transform-class-properties"],
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-json-strings"
],
"ignore": [
"*.test.js"
]
},
"commonjs": {
"plugins": [
["transform-es2015-modules-commonjs", { "loose": true }],
"transform-class-properties"
[
"@babel/plugin-transform-modules-commonjs",
{
"loose": true
}
],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-json-strings"
],
"presets": [
"@babel/preset-react"
],
"presets": ["stage-3", "react"],
"ignore": [
"*.test.js"
]
},
"test": {
"presets": ["env", "stage-3", "react"],
"plugins": ["transform-class-properties"]
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-json-strings"
]
}
}
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 8
- 10
sudo: false
matrix:
include:
Expand Down
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,32 @@
"react": ">=0.14.9"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.1.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@testing-library/jest-dom": "5.10.0",
"@testing-library/react": "10.2.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.12",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-3": "^6.24.1",
"coveralls": "3.1.0",
"cross-env": "^5.2.0",
"in-publish": "2.0.0",
"jest": "^22.4.3",
"jest-dom": "3.1.4",
"cross-env": "^7.0.2",
"in-publish": "2.0.1",
"jest": "26.0.1",
"prop-types": "~15.6.2",
"react": "^16.3.0",
"react-dom": "^16.3.0",
"react-testing-library": "^4.0.0",
"rollup": "^0.45.1",
"rollup-plugin-babel": "^3.0.5",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.2.1",
"rollup-plugin-uglify": "^2.0.1"
"rollup": "^2.16.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.4"
},
"jest": {
"testURL": "http://localhost/",
Expand Down
26 changes: 14 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import { uglify } from 'rollup-plugin-uglify';
import replace from 'rollup-plugin-replace';

var env = process.env.NODE_ENV;
var config = {
format: 'umd',
moduleName: 'ReactLocalize',
external: ['react', 'prop-types'],
globals: {
react: 'React',
'prop-types': 'PropTypes',
},
context: 'this',
input: 'src/index.js',
plugins: [
nodeResolve({
jsnext: true
mainFields: ['jsnext:main', 'main', 'module'],
}),
commonjs({
include: 'node_modules/**'
Expand All @@ -31,7 +24,17 @@ var config = {
replace({
'process.env.NODE_ENV': JSON.stringify(env)
})
]
],
external: ['react', 'prop-types'],
output: {
format: 'umd',
name: 'ReactLocalize',
globals: {
react: 'React',
'prop-types': 'PropTypes',
},
},
context: 'this',
};

if (env === 'production') {
Expand All @@ -41,7 +44,6 @@ if (env === 'production') {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false
}
})
);
Expand Down
4 changes: 2 additions & 2 deletions src/react-localize.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from 'react';
import { render } from 'react-testing-library';
import 'jest-dom/extend-expect';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { LocalizationConsumer, LocalizationProvider, withLocalization, useLocalize } from './index';

const messages = {
Expand Down
2 changes: 1 addition & 1 deletion src/util.format.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'jest-dom/extend-expect';
import '@testing-library/jest-dom/extend-expect';
import format from './util.format';

test('formats a string properly when no values are provided', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/withLocalization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { LocalizationConsumer } from '.';
import { LocalizationConsumer } from './react-localize';

export default (Component) => {
const withLocalization = (props) => <LocalizationConsumer>
Expand Down
Loading