Merge pull request #2337 from lbryio/fix-games-dev-log

Fix games and logging (and builds)
This commit is contained in:
Shawn K 2019-03-15 14:01:53 -05:00 committed by GitHub
commit e932e1ed43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 182 additions and 77 deletions

View file

@ -6,19 +6,19 @@
},
"files": [
{
"from": "dist/electron",
"from": "dist/electron/ui",
"to": "./",
"filter": ["!dist/!electron/**/*"]
"filter": ["!dist/!electron/ui/**/*"]
},
{
"from": "dist/electron/webpack",
"to": "./",
"filter": ["!dist/!electron/!webpack/*.js", "!dist/!electron/!webpack/!static/**/*"]
},
{
"from": "dist/electron/static",
"to": "./",
"filter": ["!dist/!electron/static/**/*"]
},
{
"from": "dist/electron/ui",
"to": "./",
"filter": ["!dist/!electron/ui/**/*"]
"filter": ["!dist/!electron/!static/index.html"]
}
],
"publish": [

View file

@ -57,7 +57,7 @@
"express": "^4.16.4",
"formik": "^0.10.4",
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.3.0",
"keytar": "4.4.1",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#2a7e05940f892f104428eeb37bd1f178da811a09",
"lbryinc": "lbryio/lbryinc#351d0a08806b0f770b50066b61a806171f6424d4",
@ -106,6 +106,7 @@
"@babel/plugin-transform-flow-strip-types": "^7.2.3",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@hot-loader/react-dom": "16.8",
"@lbry/color": "^1.0.2",
"@lbry/components": "^2.2.4",
@ -113,6 +114,7 @@
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-transform-imports": "^1.5.1",
"chalk": "^2.4.2",
"copy-webpack-plugin": "^4.6.0",
"cross-env": "^5.2.0",
@ -120,7 +122,7 @@
"decompress": "^4.2.0",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^4.0.4",
"electron": "4.1.0",
"electron-builder": "^20.38.4",
"electron-devtools-installer": "^2.2.3",
"electron-publisher-s3": "^20.8.1",

View file

@ -0,0 +1,14 @@
{
"presets": [
["@babel/preset-env", { "useBuiltIns": "entry" }],
"@babel/react",
"@babel/flow"
],
"plugins": [
"babel-plugin-transform-imports",
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
"@babel/plugin-transform-flow-strip-types",
"@babel/plugin-proposal-class-properties",
"babel-plugin-add-module-exports"
]
}

View file

@ -65,4 +65,8 @@ mainInstance.waitUntilValid(() => {
const proc = require('child_process');
const child = proc.spawn(electron, ['./dist/electron/main.js']);
child.stdout.on('data', (data) => {
console.log(data.toString());
});
});

View file

@ -13,7 +13,7 @@ import Daemon from './Daemon';
import createTray from './createTray';
import createWindow from './createWindow';
import pjson from '../../../package.json';
// import startSandbox from './startSandbox';
import startSandbox from './startSandbox';
autoUpdater.autoDownload = true;
@ -36,13 +36,9 @@ let daemon;
const appState = {};
const installExtensions = async () => {
// // eslint-disable-next-line import/no-extraneous-dependencies,global-require
// const installer = require('electron-devtools-installer');
// // eslint-disable-next-line import/no-extraneous-dependencies,global-require
// const devtronExtension = require('devtron');
// const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
// await devtronExtension.install();
// return Promise.all(extensions.map(name => installer.default(installer[name]))).catch(console.log);
// eslint-disable-next-line import/no-extraneous-dependencies,global-require
const devtronExtension = require('devtron');
return await devtronExtension.install();
};
app.setAsDefaultProtocolClient('lbry');
@ -89,7 +85,7 @@ app.on('ready', async () => {
daemon.launch();
}
// startSandbox();
startSandbox();
if (isDev) {
await installExtensions();

View file

@ -0,0 +1,4 @@
require('@babel/register');
require("@babel/polyfill");
require('./startSandbox.js')();

View file

@ -1,28 +1,32 @@
// import express from 'express';
// import unpackByOutpoint from './unpackByOutpoint';
import express from 'express';
import unpackByOutpoint from './unpackByOutpoint';
// // Polyfills and `lbry-redux`
// global.fetch = require('node-fetch');
// Polyfills and `lbry-redux`
global.fetch = require('node-fetch');
global.window = global;
if (typeof(global.fetch) === 'object') {
global.fetch = global.fetch.default;
}
// global.window = global;
// // eslint-disable-next-line import/no-commonjs,global-require
// const { Lbry } = require('lbry-redux');
// eslint-disable-next-line import/no-commonjs,global-require
const { Lbry } = require('lbry-redux');
// delete global.window;
delete global.window;
// export default async function startSandbox() {
// const sandbox = express();
// const port = 5278;
export default async function startSandbox() {
const sandbox = express();
const port = 5278;
// sandbox.get('/set/:outpoint', async (req, res) => {
// const { outpoint } = req.params;
// const resolvedPath = await unpackByOutpoint(Lbry, outpoint);
sandbox.get('/set/:outpoint', async (req, res) => {
const { outpoint } = req.params;
// sandbox.use(`/sandbox/${outpoint}/`, express.static(resolvedPath));
const resolvedPath = await unpackByOutpoint(Lbry, outpoint);
// res.send(`/sandbox/${outpoint}/`);
// });
sandbox.use(`/sandbox/${outpoint}/`, express.static(resolvedPath));
// // eslint-disable-next-line no-console
// sandbox.listen(port, 'localhost', () => console.log(`Sandbox listening on port ${port}.`));
// }
res.send(`/sandbox/${outpoint}/`);
});
// eslint-disable-next-line no-console
sandbox.listen(port, 'localhost', () => console.log(`Sandbox listening on port ${port}.`));
}

View file

@ -202,7 +202,9 @@ class MediaPlayer extends React.PureComponent<Props, State> {
}
const playerElement = this.mediaContainer.current;
if (playerElement) {
playerElement.children[0].play();
if(playerElement.children && playerElement.children[0]) {
playerElement.children[0].play();
}
}
}
// @endif
@ -324,6 +326,7 @@ class MediaPlayer extends React.PureComponent<Props, State> {
const { fileSource } = this.state;
const isFileType = this.isSupportedFile();
const isFileReady = fileSource && isFileType;
const isPlayableType = this.playableType();
const { isLoading, loadingStatus } = this.showLoadingScreen(isFileType, isPlayableType);

View file

@ -1,4 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const { DefinePlugin, ProvidePlugin } = require('webpack');
const { getIfUtils, removeEmpty } = require('webpack-config-utils');

View file

@ -14,14 +14,10 @@ const mainConfig = {
},
output: {
filename: '[name].js',
path: __dirname + '/dist/electron',
path: __dirname + '/dist/electron/webpack',
},
module: {
rules: [
{
test: /\.node$/,
use: 'node-loader',
},
{
test: /\.jsx?$/,
use: [
@ -43,17 +39,16 @@ const mainConfig = {
{
from: `${STATIC_ROOT}/`,
to: `${DIST_ROOT}/electron/static/`,
ignore: ['font/**/*', 'index.html'],
},
{
from: `${STATIC_ROOT}/index.html`,
to: `${DIST_ROOT}/electron/index.html`,
ignore: ['font/**/*'],
},
]),
],
devServer: {
contentBase: path.join(__dirname, 'dist/electron'),
},
externals: {
keytar: 'require("keytar")',
},
};
const renderConfig = {
@ -63,14 +58,10 @@ const renderConfig = {
},
output: {
filename: '[name].js',
path: __dirname + '/dist/electron',
path: __dirname + '/dist/electron/webpack',
},
module: {
rules: [
{
test: /\.node$/,
use: 'node-loader',
},
{
test: /\.jsx?$/,
use: [
@ -87,23 +78,6 @@ const renderConfig = {
},
],
},
plugins: [
new CopyWebpackPlugin([
{
from: `${STATIC_ROOT}/`,
to: `${DIST_ROOT}/electron/static/`,
ignore: ['font/**/*', 'index.html', 'index.dev.html'],
},
{
from: `${STATIC_ROOT}/index.html`,
to: `${DIST_ROOT}/electron/index.html`,
},
{
from: `${STATIC_ROOT}/index.dev.html`,
to: `${DIST_ROOT}/electron/index.dev.html`,
},
]),
],
};
module.exports = [merge(baseConfig, mainConfig), merge(baseConfig, renderConfig)];

113
yarn.lock
View file

@ -714,6 +714,19 @@
"@babel/plugin-transform-react-jsx-self" "^7.0.0"
"@babel/plugin-transform-react-jsx-source" "^7.0.0"
"@babel/register@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.0.0.tgz#fa634bae1bfa429f60615b754fc1f1d745edd827"
integrity sha512-f/+CRmaCe7rVEvcvPvxeA8j5aJhHC3aJie7YuqcMDhUOuyWLA7J/aNrTaHIzoWPEhpHA54mec4Mm8fv8KBlv3g==
dependencies:
core-js "^2.5.7"
find-cache-dir "^1.0.0"
home-or-tmp "^3.0.0"
lodash "^4.17.10"
mkdirp "^0.5.1"
pirates "^4.0.0"
source-map-support "^0.5.9"
"@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0":
version "7.3.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.3.4.tgz#73d12ba819e365fcf7fd152aed56d6df97d21c83"
@ -1491,6 +1504,18 @@ babel-plugin-component@^1.1.1:
dependencies:
"@babel/helper-module-imports" "7.0.0-beta.35"
babel-plugin-transform-imports@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-imports/-/babel-plugin-transform-imports-1.5.1.tgz#b3756696aea907719d0d63b0e67c88fba963adb0"
integrity sha512-Jkb0tjqye8kjOD7GdcKJTGB3dC9fruQhwRFZCeYS0sZO2otyjG6SohKR8nZiSm/OvhY+Ny2ktzVE59XKgIqskA==
dependencies:
babel-types "^6.6.0"
is-valid-path "^0.1.1"
lodash.camelcase "^4.3.0"
lodash.findkey "^4.6.0"
lodash.kebabcase "^4.1.1"
lodash.snakecase "^4.1.1"
babel-polyfill@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
@ -1508,6 +1533,16 @@ babel-runtime@6.x, babel-runtime@^6.26.0:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"
babel-types@^6.6.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497"
integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=
dependencies:
babel-runtime "^6.26.0"
esutils "^2.0.2"
lodash "^4.17.4"
to-fast-properties "^1.0.3"
bail@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.3.tgz#63cfb9ddbac829b02a3128cd53224be78e6c21a3"
@ -3533,10 +3568,10 @@ electron-window-state@^4.1.1:
jsonfile "^2.2.3"
mkdirp "^0.5.1"
electron@^4.0.4:
version "4.0.6"
resolved "https://registry.yarnpkg.com/electron/-/electron-4.0.6.tgz#f936772ddb5eaa026591ea14ef806e1385fbbda9"
integrity sha512-r2ow/EmDibjoCNJp35mB1CcPs2xBF9fp2eoWuUOJmpVQyzdba6EnqsSD1BxwXzF9vQ5WkQ2UbfXBIvpomrdioQ==
electron@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/electron/-/electron-4.1.0.tgz#ecba9c83de271e8ba7637332ece9ed023c6ea3f0"
integrity sha512-q/yTi9dT5UEFK/s+vOQaHNkTHWiRK9kEBYVJt34nmWc9piW42hXT+nhKUEHHhccMPr3q18gG0iPZqeR+LG76ow==
dependencies:
"@types/node" "^10.12.18"
electron-download "^4.1.0"
@ -4955,6 +4990,11 @@ hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0:
dependencies:
react-is "^16.7.0"
home-or-tmp@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb"
integrity sha1-V6j+JM8zzdUkhgoVgh3cJchmcfs=
homedir-polyfill@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"
@ -5477,6 +5517,11 @@ is-extendable@^1.0.1:
dependencies:
is-plain-object "^2.0.4"
is-extglob@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0"
integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=
is-extglob@^2.1.0, is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
@ -5506,6 +5551,13 @@ is-function@^1.0.1:
resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.1.tgz#12cfb98b65b57dd3d193a3121f5f6e2f437602b5"
integrity sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=
is-glob@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863"
integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=
dependencies:
is-extglob "^1.0.0"
is-glob@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
@ -5533,6 +5585,13 @@ is-installed-globally@^0.1.0:
global-dirs "^0.1.0"
is-path-inside "^1.0.0"
is-invalid-path@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-invalid-path/-/is-invalid-path-0.1.0.tgz#307a855b3cf1a938b44ea70d2c61106053714f34"
integrity sha1-MHqFWzzxqTi0TqcNLGEQYFNxTzQ=
dependencies:
is-glob "^2.0.0"
is-nan@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.2.1.tgz#9faf65b6fb6db24b7f5c0628475ea71f988401e2"
@ -5666,6 +5725,13 @@ is-utf8@^0.2.0:
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=
is-valid-path@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/is-valid-path/-/is-valid-path-0.1.1.tgz#110f9ff74c37f663e1ec7915eb451f2db93ac9df"
integrity sha1-EQ+f90w39mPh7HkV60UfLbk6yd8=
dependencies:
is-invalid-path "^0.1.0"
is-whitespace-character@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz#ede53b4c6f6fb3874533751ec9280d01928d03ed"
@ -5916,7 +5982,7 @@ kebab-case@^1.0.0:
resolved "https://registry.yarnpkg.com/kebab-case/-/kebab-case-1.0.0.tgz#3f9e4990adcad0c686c0e701f7645868f75f91eb"
integrity sha1-P55JkK3K0MaGwOcB92RYaPdfkes=
keytar@^4.3.0:
keytar@4.4.1:
version "4.4.1"
resolved "https://registry.yarnpkg.com/keytar/-/keytar-4.4.1.tgz#156af8a9b016bf118ee9948b02418c81d760a5ba"
integrity sha512-6xEe7ybXSR5EZC+z0GI2yqLYZjV1tyPQY2xSZ8rGsBxrrLEh8VR/Lfqv59uGX+I+W+OZxH0jCXN1dU1++ify4g==
@ -6176,11 +6242,21 @@ lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.2.0:
resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7"
integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=
lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=
lodash.clonedeep@^4.3.2:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
lodash.findkey@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718"
integrity sha1-gwWOkDtRy7dZ0JzPVG3qPqOcRxg=
lodash.forin@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.forin/-/lodash.forin-4.4.0.tgz#5d3f20ae564011fbe88381f7d98949c9c9519731"
@ -6201,6 +6277,11 @@ lodash.isequal@4.5.0, lodash.isequal@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
lodash.kebabcase@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY=
lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
@ -6221,6 +6302,11 @@ lodash.set@^4.3.2:
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=
lodash.snakecase@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d"
integrity sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40=
lodash.tail@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664"
@ -6954,6 +7040,11 @@ node-loader@^0.6.0:
resolved "https://registry.yarnpkg.com/node-loader/-/node-loader-0.6.0.tgz#c797ef51095ed5859902b157f6384f6361e05ae8"
integrity sha1-x5fvUQle1YWZArFX9jhPY2HgWug=
node-modules-regexp@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=
node-pre-gyp@^0.10.0:
version "0.10.3"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
@ -7613,6 +7704,13 @@ pinkie@^2.0.0:
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
pirates@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87"
integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==
dependencies:
node-modules-regexp "^1.0.0"
pkcs7@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pkcs7/-/pkcs7-1.0.2.tgz#b6dba527528c2942bfc122ce2dafcdb5e59074e7"
@ -10062,6 +10160,11 @@ to-buffer@^1.1.1:
resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80"
integrity sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==
to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=
to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"