Skip to content

Commit a29432e

Browse files
authored
Merge pull request #97 from stasm/fix-react-examples
Use local fluent dependencies in fluent-react examples
2 parents d8b0e97 + 6ff4db2 commit a29432e

File tree

43 files changed

+134
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+134
-129
lines changed

fluent-dom/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"localization",
2828
"l10n"
2929
],
30-
"engines" : {
31-
"node" : ">=8.9.0"
30+
"engines": {
31+
"node": ">=8.9.0"
3232
},
3333
"devDependencies": {
3434
"jsdom": "^9.12.0"

fluent-intl-polyfill/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"localization",
2929
"l10n"
3030
],
31-
"engines" : {
32-
"node" : ">=8.9.0"
31+
"engines": {
32+
"node": ">=8.9.0"
3333
},
3434
"dependencies": {
3535
"intl-pluralrules": "projectfluent/IntlPluralRules#module"

fluent-langneg/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"localization",
2929
"l10n"
3030
],
31-
"engines" : {
32-
"node" : ">=8.9.0"
31+
"engines": {
32+
"node": ">=8.9.0"
3333
}
3434
}

fluent-react/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ version of Babel's [latest preset][]:
3939
import 'fluent-react/compat';
4040
```
4141

42-
In some cases, using the `compat` build may be needed even if you target modern
43-
browsers. For instance, the `create-react-app` boilerplate uses UglifyJS to
44-
minify its files. As of April 2017, UglifyJS doesn't support some of the new
45-
JavaScript syntax features. By using the `compat` build of all `fluent`
46-
packages you can ensure that the minifiction works properly.
42+
In some cases, using the `compat` build may be needed even if you target
43+
modern browsers. For instance, the [`create-react-app` boilerplate uses
44+
UglifyJS to minify its files][create-react-app-minify]. As of November 2017,
45+
UglifyJS doesn't support some of the new JavaScript syntax features. By using
46+
the `compat` build of all `fluent` packages you can ensure that the
47+
minifiction works properly.
48+
49+
50+
[create-react-app-minify]: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
4751

4852

4953
## Learn more

fluent-react/examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ These tiny React apps demonstrate how `fluent-react` can integrate with React.
55
cd hello-world
66
npm install
77
npm start
8+
9+
All examples link to the local ES2015+ `fluent` modules as dependencies. They
10+
are resolved via the `module` field of their `package.json` files and thus do
11+
not require to be built nor transpiled beforehand.

fluent-react/examples/async-messages/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"version": "0.1.0",
44
"private": true,
55
"devDependencies": {
6-
"react-scripts": "0.9.0"
6+
"react-scripts": "1.0.17"
77
},
88
"dependencies": {
9-
"delay": "^1.3.1",
10-
"fluent": "^0.4.0",
11-
"fluent-intl-polyfill": "^0.1.0",
12-
"fluent-langneg": "^0.1.0",
13-
"fluent-react": "^0.3.0",
14-
"react": "^15.4.2",
15-
"react-dom": "^15.4.2"
9+
"delay": "^2.0.0",
10+
"fluent": "file:../../../fluent",
11+
"fluent-intl-polyfill": "file:../../../fluent-intl-polyfill",
12+
"fluent-langneg": "file:../../../fluent-langneg",
13+
"fluent-react": "file:../../../fluent-react",
14+
"react": "^16.1.1",
15+
"react-dom": "^16.1.1"
1616
},
1717
"scripts": {
1818
"start": "react-scripts start",

fluent-react/examples/async-messages/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Localized } from 'fluent-react/compat';
2+
import { Localized } from 'fluent-react';
33

44
export default function App() {
55
return (

fluent-react/examples/async-messages/src/l10n.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { Component } from 'react';
22
import delay from 'delay';
33

4-
import 'fluent-intl-polyfill/compat';
5-
import { MessageContext } from 'fluent/compat';
6-
import { LocalizationProvider } from 'fluent-react/compat';
7-
import { negotiateLanguages } from 'fluent-langneg/compat';
4+
import 'fluent-intl-polyfill';
5+
import { MessageContext } from 'fluent';
6+
import { LocalizationProvider } from 'fluent-react';
7+
import { negotiateLanguages } from 'fluent-langneg';
88

99
async function fetchMessages(locale) {
1010
const { PUBLIC_URL } = process.env;

fluent-react/examples/change-language/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"version": "0.1.0",
44
"private": true,
55
"devDependencies": {
6-
"react-scripts": "0.9.0"
6+
"react-scripts": "1.0.17"
77
},
88
"dependencies": {
9-
"fluent": "^0.4.0",
10-
"fluent-intl-polyfill": "^0.1.0",
11-
"fluent-langneg": "^0.1.0",
12-
"fluent-react": "^0.3.0",
13-
"react": "^15.4.2",
14-
"react-dom": "^15.4.2"
9+
"fluent": "file:../../../fluent",
10+
"fluent-intl-polyfill": "file:../../../fluent-intl-polyfill",
11+
"fluent-langneg": "file:../../../fluent-langneg",
12+
"fluent-react": "file:../../../fluent-react",
13+
"react": "^16.1.1",
14+
"react-dom": "^16.1.1"
1515
},
1616
"scripts": {
1717
"start": "react-scripts start",

fluent-react/examples/change-language/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Localized } from 'fluent-react/compat';
2+
import { Localized } from 'fluent-react';
33

44
export default function App(props) {
55
const { currentLocales, handleLocaleChange } = props;

0 commit comments

Comments
 (0)