Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

Commit 8b2ddd2

Browse files
committed
all: use .editorconfig from facebook/react
1 parent bdc091c commit 8b2ddd2

33 files changed

+3110
-632
lines changed

.babelrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"presets": ["react"],
2+
"presets": [
3+
"env",
4+
"react",
5+
"stage-2"
6+
],
37
"plugins": [
4-
"external-helpers",
58
"transform-flow-strip-types"
69
]
710
}

.editorconfig

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
; common
1+
root = true
2+
23
[*]
34
charset = utf-8
4-
end_of_line = LF
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
58
insert_final_newline = true
9+
max_line_length = 80
610
trim_trailing_whitespace = true
7-
indent_style = space
8-
indent_size = 2
911

10-
; markdown
1112
[*.md]
13+
max_line_length = 0
1214
trim_trailing_whitespace = false
13-
indent_size = 2
14-
indent_style = tab
15+
16+
[COMMIT_EDITMSG]
17+
max_line_length = 0

.flowconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[ignore]
2+
<PROJECT_ROOT>/src/.*
3+
4+
<PROJECT_ROOT>/build/.*
5+
<PROJECT_ROOT>/cli/.*
6+
<PROJECT_ROOT>/scripts/.*
7+
<PROJECT_ROOT>/.*/__mocks__/.*
8+
<PROJECT_ROOT>/.*/__tests__/.*
9+
10+
[include]
11+
./node_modules/fbjs/flow/lib/dev.js
12+
./node_modules/react-fiber-types
13+
munge_underscores=false
14+
15+
[libs]
16+
17+
[options]
18+
esproposal.class_static_fields=enable
19+
esproposal.class_instance_fields=enable
20+
unsafe.enable_getters_and_setters=true
21+
22+
[version]
23+
^0.57

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test
22
scripts/prettier
33
resources/images
4-
samples/clock-app-tv
4+
examples/
55
build

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
>=8
1+
v8.4.0

README.md

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
# React-TV [![circleci status](https://circleci.com/gh/raphamorim/react-tv/tree/master.svg?style=shield)](https://circleci.com/gh/raphamorim/react-tv) [![npm version](https://img.shields.io/npm/v/react-tv.svg?style=flat)](https://www.npmjs.com/package/react-tv) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
1+
# [React-TV](https://github.com/raphamorim/react-tv) 📺 • [![circleci status](https://circleci.com/gh/raphamorim/react-tv/tree/master.svg?style=shield)](https://circleci.com/gh/raphamorim/react-tv) [![npm version](https://img.shields.io/npm/v/react-tv.svg?style=flat)](https://www.npmjs.com/package/react-tv) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
22

3-
> React development for TV (WebOS, Tizen, Orsay) 📺
4-
5-
> **tl;dr** It's like `react-DOM` for low memory applications and packager for TV as platform.
3+
> A `react-DOM` like for low memory applications and packager for TV as platform.
64
75
![React-TV Logo](resources/images/reactv-cover-dark.png)
86

97
```jsx
108
import React from 'react'
11-
import ReactTV, { Platform } from 'react-tv'
9+
import ReactTV, { Platform } from 'ReactTV'
1210

1311
class Clock extends React.Component {
14-
state = { date: new Date() }
15-
16-
render() {
17-
if (Platform.webos) {
18-
return (
19-
<div>
20-
<h1>Hello, {Platform}</h1>
21-
<h2>It is {this.state.date.toLocaleTimeString()}</h2>
22-
</div>
23-
)
24-
}
25-
26-
return <div>This App is available only at LG WebOS</div>
27-
}
12+
state = { date: new Date() }
13+
14+
componentDidMount() {
15+
setInterval(() => this.setState({date: new Date()}), 1000)
16+
}
17+
18+
render() {
19+
if (Platform('webos')) {
20+
return (
21+
<h1>Time is {this.state.date.toLocaleTimeString()}</h1>
22+
)
23+
}
24+
25+
return <h2>This App is available only at LG WebOS</h2>
26+
}
2827
}
2928

30-
ReactTV.render(Clock, document.getElementById('root'))
29+
ReactTV.render(<Clock/>, document.getElementById('root'))
3130
```
3231

3332
## Summary
3433

3534
- [About React-TV](#about-react-tv)
36-
- [Understanding the Problem](#understanding-the-problem)
35+
- [Understanding the Problem](#understanding-the-problem)
3736
- [Getting Started](#getting-started)
38-
- [Installing](#installing)
39-
- [Examples](#examples)
40-
- [Using CLI](#using-cli)
41-
- [Using Module](#using-module)
37+
- [Installing](#installing)
38+
- [Examples](#examples)
39+
- [Using CLI](#using-cli)
40+
- [Using Module](#using-module)
4241
- [Supported Televisions](#supported-televisions)
43-
- [LG WebOS](#lg-webos)
42+
- [LG WebOS](#lg-webos)
4443
- [References for Study](#references)
45-
- [WebOS](#webos)
46-
- [Videos](#videos)
47-
- [Essentials to beginner](#essentials-to-beginner)
48-
- [React Basics and Renderer Architecture](#react-basics-and-renderer-architecture)
44+
- [WebOS](#webos)
45+
- [Videos](#videos)
46+
- [Essentials to beginner](#essentials-to-beginner)
47+
- [React Basics and Renderer Architecture](#react-basics-and-renderer-architecture)
4948
- [TODOLIST for 1.0.0](#todolist)
5049

5150
## About React-TV
@@ -218,25 +217,25 @@ Thanks [react-dom](https://github.com/facebook/react/tree/master/packages/react-
218217
## TODOLIST
219218

220219
- [ ] {cli} init project
221-
- [x] mkdir app-path
222-
- [x] generate react app tv based on app-name and app-path
223-
- [ ] create a npm script on app: `react-tv run-webos-dev`
220+
- [x] mkdir app-path
221+
- [x] generate react app tv based on app-name and app-path
222+
- [ ] create a npm script on app: `react-tv run-webos-dev`
224223
- [ ] {cli} run-webos-dev
225-
- [ ] mount bundle (crow-scripts) or Webpack
226-
- [ ] check if exists webpack config existent on folder
227-
- [ ] copy bundle for respective folders
228-
- [x] run server (express?)
224+
- [ ] mount bundle (crow-scripts) or Webpack
225+
- [ ] check if exists webpack config existent on folder
226+
- [ ] copy bundle for respective folders
227+
- [x] run server (express?)
229228
- [ ] {cli} run-webos
230-
- [ ] CROW bundling or Webpack
231-
- [ ] Check executable bin path for Windows, OSX and Linux
232-
- [x] pack and install script
233-
- [x] check if virtualbox is up
234-
- [x] launch
235-
- [x] `--disable-emulator`
229+
- [ ] CROW bundling or Webpack
230+
- [ ] Check executable bin path for Windows, OSX and Linux
231+
- [x] pack and install script
232+
- [x] check if virtualbox is up
233+
- [x] launch
234+
- [x] `--disable-emulator`
236235
- [ ] {renderer}
237-
- [ ] WebOS
238-
- [x] platform
239-
- [ ] volume
240-
- [ ] Tizen
241-
- [ ] platform
242-
- [ ] volume
236+
- [ ] WebOS
237+
- [x] platform
238+
- [ ] volume
239+
- [ ] Tizen
240+
- [ ] platform
241+
- [ ] volume

examples/clock-vanilla/example.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,28 @@ var Clock = function (_React$Component) {
5454
}
5555

5656
_createClass(Clock, [{
57+
key: 'componentDidMount',
58+
value: function componentDidMount() {
59+
var _this2 = this;
60+
61+
setInterval(function () {
62+
return _this2.setState({ date: new Date() });
63+
}, 1000);
64+
}
65+
}, {
5766
key: 'render',
5867
value: function render() {
5968
if (Platform.webos) {
6069
return React.createElement(
61-
'div',
70+
'h1',
6271
null,
63-
React.createElement(
64-
'h1',
65-
null,
66-
'Hello, ',
67-
Platform
68-
),
69-
React.createElement(
70-
'h2',
71-
null,
72-
'It is ',
73-
this.state.date.toLocaleTimeString()
74-
)
72+
'Time is ',
73+
this.state.date.toLocaleTimeString()
7574
);
7675
}
7776

7877
return React.createElement(
79-
'div',
78+
'h2',
8079
null,
8180
'This App is available only at LG WebOS'
8281
);
@@ -86,5 +85,9 @@ var Clock = function (_React$Component) {
8685
return Clock;
8786
}(React.Component);
8887

89-
console.log(Platform);
90-
ReactTV.render(Clock, document.getElementById('root'));
88+
function fn() {
89+
console.log('hatake kakashi...');
90+
};
91+
92+
const reactElement = React.createElement('div', {onClick: fn}, 'click');
93+
ReactTV.render(reactElement, document.getElementById('root'));

package.json

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "react-tv",
3-
"version": "0.1.4-rc.1",
3+
"version": "0.2.0",
44
"description": "React development for TV (WebOS, Tizen, Orsay)",
55
"main": "src/ReactTVEntry.js",
66
"bin": {
77
"react-tv": "./cli"
88
},
99
"scripts": {
1010
"build": "node scripts/rollup/build.js",
11-
"test": "sh ./test/run-all.sh",
12-
"flow": "pushd src; flow; popd;",
11+
"test": "yarn flow && jest",
12+
"flow": "flow",
1313
"prettier": "node ./scripts/prettier/index.js write-changed",
1414
"prettier-all": "node ./scripts/prettier/index.js write"
1515
},
@@ -18,18 +18,20 @@
1818
"express": "^4.15.4",
1919
"fbjs": "^0.8.4",
2020
"fs-extra": "^4.0.1",
21-
"glob": "^7.1.2",
2221
"node-replace": "^0.3.1",
2322
"react": "16.0.0-alpha.3",
2423
"react-dom": "16.0.0-alpha.3"
2524
},
2625
"devDependencies": {
27-
"babel-plugin-external-helpers": "^6.22.0",
26+
"babel-jest": "20.1.0-delta.1",
27+
"babel-plugin-transform-flow-strip-types": "^6.22.0",
28+
"babel-preset-env": "^1.6.1",
2829
"babel-preset-react": "^6.24.1",
30+
"babel-preset-stage-2": "^6.24.1",
2931
"babel-register": "^6.26.0",
3032
"commitplease": "^3.1.0",
3133
"flow-bin": "^0.57.3",
32-
"gzip-size": "^3.0.0",
34+
"jest": "20.1.0-delta.1",
3335
"prettier": "^1.5.3",
3436
"react-fiber-types": "file:src/renderer/types",
3537
"rollup": "^0.41.6",
@@ -75,5 +77,16 @@
7577
"bugs": {
7678
"url": "https://github.com/raphamorim/react-tv/issues"
7779
},
78-
"homepage": "https://github.com/raphamorim/react-tv#readme"
80+
"homepage": "https://github.com/raphamorim/react-tv#readme",
81+
"jest": {
82+
"roots": [
83+
"<rootDir>/src"
84+
],
85+
"moduleDirectories": [
86+
"node_modules",
87+
"src"
88+
],
89+
"verbose": true,
90+
"resetModules": true
91+
}
7992
}

scripts/jest/environment.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// For testing DOM Fiber.
2+
global.requestAnimationFrame = function(callback) {
3+
setTimeout(callback);
4+
};
5+
6+
global.requestIdleCallback = function(callback) {
7+
setTimeout(() => {
8+
callback({
9+
timeRemaining() {
10+
return Infinity;
11+
},
12+
});
13+
});
14+
};

0 commit comments

Comments
 (0)