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

Commit de82ad5

Browse files
committed
all: migrate clock-with-react-tv example to webpack3
1 parent 08628ca commit de82ad5

File tree

9 files changed

+116
-68
lines changed

9 files changed

+116
-68
lines changed

cli/bootstrap/custom-app/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
},
1616
"dependencies": {
1717
"react": "^16.0.0",
18-
"react-tv": "^0.3.0-alpha.2"
18+
"react-tv": "0.3.0-alpha.3"
1919
},
2020
"devDependencies": {
21-
"babel-core": "^6.4.5",
22-
"babel-loader": "^6.2.1",
21+
"webpack": "^3.8.1",
22+
"webpack-dev-server": "^2.9.4",
23+
"babel-core": "^6.26.0",
24+
"babel-loader": "^7.1.2",
2325
"babel-preset-env": "^1.6.1",
24-
"babel-preset-react": "^6.3.13",
25-
"webpack": "^1.12.12",
26-
"webpack-dev-server": "^1.12.1"
26+
"babel-preset-react": "^6.24.1",
27+
"uglifyjs-webpack-plugin": "^1.0.1"
2728
}
2829
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
4+
5+
const sourcePath = path.join(__dirname, 'src');
6+
7+
module.exports = {
8+
entry: path.resolve(sourcePath, 'App.js'),
9+
output: {
10+
path: __dirname,
11+
filename: 'bundle.js'
12+
},
13+
resolve: {
14+
extensions: ['.js', '.jsx'],
15+
modules: [
16+
sourcePath,
17+
path.resolve(__dirname, 'node_modules')
18+
]
19+
},
20+
module: {
21+
rules: [
22+
{
23+
test: /\.(js|jsx)$/,
24+
exclude: /node_modules/,
25+
use: [
26+
'babel-loader'
27+
],
28+
include: sourcePath
29+
}
30+
]
31+
},
32+
plugins: [
33+
new webpack.DefinePlugin({
34+
'process.env.NODE_ENV': JSON.stringify('production')
35+
}),
36+
new webpack.optimize.ModuleConcatenationPlugin(),
37+
new UglifyJsPlugin(),
38+
new webpack.HashedModuleIdsPlugin(),
39+
]
40+
}

cli/bootstrap/custom-app/webpack.config.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

cli/scripts/webos/run.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,31 @@ function runWebOS(root) {
4444
}
4545

4646
const webosPath = path.resolve(root, 'react-tv/webos');
47+
48+
process.on('exit', cleanup);
49+
process.on('SIGINT', cleanup);
50+
process.on('SIGUSR1', cleanup);
51+
process.on('SIGUSR2', cleanup);
52+
process.on('uncaughtException', cleanup);
53+
54+
function cleanup() {
55+
execSync(`rm -f ${webosPath}/icon.png`);
56+
execSync(`rm -f ${webosPath}/icon-large.png`);
57+
ReactTVConfig.files.forEach(file => {
58+
execSync(`rm -f ${webosPath}/${file}`);
59+
})
60+
}
61+
4762
try {
48-
execSync(`ln -sf ${root}/react-tv/icon.png ${webosPath}/icon.png`);
63+
cleanup();
64+
execSync(`cp ${root}/react-tv/icon.png ${webosPath}/icon.png`);
4965
execSync(
50-
`ln -sf ${root}/react-tv/icon-large.png ${webosPath}/icon-large.png`
66+
`cp ${root}/react-tv/icon-large.png ${webosPath}/icon-large.png`
5167
);
5268

5369
ReactTVConfig.files.forEach(file => {
5470
const filePath = path.resolve(root, file);
55-
execSync(`ln -sf ${filePath} ${webosPath}`);
71+
execSync(`cp ${filePath} ${webosPath}`);
5672
});
5773
} catch (e) {
5874
return console.log('FAIL TO MOUNT', e.toString());
@@ -70,7 +86,7 @@ function runWebOS(root) {
7086
let attemps = 0;
7187
const task = setInterval(function() {
7288
const runningVMS = execSync(`vboxmanage list runningvms`).toString();
73-
if (attemps > 15) {
89+
if (attemps > 30) {
7490
console.log('FAILED TO UP virtualbox emulator');
7591
clearInterval(task);
7692
}
@@ -88,6 +104,8 @@ function runWebOS(root) {
88104
execSync(`cd ${webosPath} && ares-package .`);
89105
console.log(chalk.yellow(` succefull pack from ${root}`));
90106

107+
cleanup();
108+
91109
console.log(chalk.dim('Installing...'));
92110
const config = JSON.parse(
93111
execSync(`cat ${webosPath}/appinfo.json`).toString()

examples/benchmark/src/Benchmark.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function testReactTV() {
3636
reactTVResults.appendChild(finalizeInitialChildren);
3737
}
3838

39-
4039
function testReactDOM() {
4140
const reactDOMResults = document.querySelector('#react-dom');
4241
const times = 10000;
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.DS_Store
22
*.log
3-
43
react-tv
54
node_modules
65
bundle.js

examples/clock-app-with-react-tv/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@
1717
},
1818
"dependencies": {
1919
"react": "^16.0.0",
20+
"react-dom": "^16.0.0",
2021
"react-tv": "0.3.0-alpha.2"
2122
},
2223
"devDependencies": {
23-
"babel-core": "^6.4.5",
24-
"babel-loader": "^6.2.1",
24+
"webpack": "^3.8.1",
25+
"webpack-dev-server": "^2.9.4",
26+
"babel-core": "^6.26.0",
27+
"babel-loader": "^7.1.2",
2528
"babel-preset-env": "^1.6.1",
26-
"babel-preset-react": "^6.3.13",
27-
"webpack": "^1.12.12",
28-
"webpack-dev-server": "^1.12.1"
29+
"babel-preset-react": "^6.24.1",
30+
"uglifyjs-webpack-plugin": "^1.0.1"
2931
}
3032
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
4+
5+
const sourcePath = path.join(__dirname, 'src');
6+
7+
module.exports = {
8+
entry: path.resolve(sourcePath, 'App.js'),
9+
output: {
10+
path: __dirname,
11+
filename: 'bundle.js'
12+
},
13+
resolve: {
14+
extensions: ['.js', '.jsx'],
15+
modules: [
16+
sourcePath,
17+
path.resolve(__dirname, 'node_modules')
18+
]
19+
},
20+
module: {
21+
rules: [
22+
{
23+
test: /\.(js|jsx)$/,
24+
exclude: /node_modules/,
25+
use: [
26+
'babel-loader'
27+
],
28+
include: sourcePath
29+
}
30+
]
31+
},
32+
plugins: [
33+
new webpack.DefinePlugin({
34+
'process.env.NODE_ENV': JSON.stringify('production')
35+
}),
36+
new webpack.optimize.ModuleConcatenationPlugin(),
37+
new UglifyJsPlugin(),
38+
new webpack.HashedModuleIdsPlugin(),
39+
]
40+
}

examples/clock-app-with-react-tv/webpack.config.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)