Skip to content

Port examples to use Create React App #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 28, 2016
Merged
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
6 changes: 0 additions & 6 deletions examples/hello-world/.babelrc

This file was deleted.

16 changes: 15 additions & 1 deletion examples/hello-world/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
build/
# See http://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# testing
coverage

# production
build

# misc
.DS_Store
.env
npm-debug.log
23 changes: 4 additions & 19 deletions examples/hello-world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,11 @@ React Intl Hello World Example

This is a very simple — yet runnable app — showing how to use React Intl to format message (string) that contains a placeholder, plural, and number.

## Running

**You first need to build the main React Intl library:**

```
$ cd ../..
$ npm run build
$ cd examples/hello-world/
```

Then you can run this example:

```
$ npm run build
$ npm start
```

or you can edit the source in `index.js` and recompile the example on fly :
## Running Example

**In the project directory, run:**
```
$ npm run watch
$ npm install
$ npm start
```
**Open [http://localhost:3000](http://localhost:3000) to view it in the browser.**
14 changes: 0 additions & 14 deletions examples/hello-world/index.html

This file was deleted.

21 changes: 10 additions & 11 deletions examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
"description": "React Intl Hello World Example",
"private": true,
"main": "index.js",
"scripts": {
"clean": "../../node_modules/.bin/rimraf build",
"build": "../../node_modules/.bin/mkdirp build && ../../node_modules/.bin/browserify index.js -d -t babelify -t browserify-shim > build/bundle.js",
"watch": "../../node_modules/.bin/mkdirp build && ../../node_modules/.bin/watchify index.js -d -t babelify -t browserify-shim -o build/bundle.js -v",
"start": "../../node_modules/.bin/babel-node server.js"
},
"author": "Eric Ferraiuolo <[email protected]>",
"license": "BSD-3-Clause",
"browser": {
"react-intl": "../../lib/index.js"
"devDependencies": {
"react-scripts": "0.6.0"
},
"browserify-shim": {
"react": "global:React",
"react-dom": "global:ReactDOM"
"dependencies": {
"react": "^15.3.2",
"react-dom": "^15.3.2",
"react-intl": "^2.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
}
}
12 changes: 12 additions & 0 deletions examples/hello-world/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>React Intl Hello World Example</title>
</head>
<body>
<div id="root"></div>
<script src="https://cdn.polyfill.io/v1/polyfill.min.js?features=Intl.~locale.en"></script>
</body>
</html>
13 changes: 0 additions & 13 deletions examples/hello-world/server.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import {IntlProvider, FormattedMessage} from 'react-intl';
import {FormattedMessage} from 'react-intl';

class App extends Component {
constructor(props) {
Expand Down Expand Up @@ -29,9 +28,5 @@ class App extends Component {
}
}

ReactDOM.render(
<IntlProvider locale="en">
<App />
</IntlProvider>,
document.getElementById('container')
);

export default App;
11 changes: 11 additions & 0 deletions examples/hello-world/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {IntlProvider} from 'react-intl';
import App from './App';

ReactDOM.render(
<IntlProvider locale="en">
<App />
</IntlProvider>,
document.getElementById('root')
);