web build sorta working

This commit is contained in:
Sean Yesmunt 2019-02-22 01:59:50 -05:00
parent 5a97077c9f
commit f25d71d1c3
12 changed files with 129 additions and 1259 deletions

View file

@ -24,8 +24,10 @@
"compile": "electron-webpack && yarn extract-langs", "compile": "electron-webpack && yarn extract-langs",
"build": "yarn compile && electron-builder build", "build": "yarn compile && electron-builder build",
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null", "build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
"build:web": "webpack",
"dev": "electron-webpack dev", "dev": "electron-webpack dev",
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev", "dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev",
"dev:web": "webpack --watch",
"lint": "eslint 'src/**/*.{js,jsx}' --fix && flow", "lint": "eslint 'src/**/*.{js,jsx}' --fix && flow",
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write", "format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
"flow-defs": "flow-typed install", "flow-defs": "flow-typed install",
@ -53,7 +55,7 @@
"hast-util-sanitize": "^1.1.2", "hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1", "keytar": "^4.2.1",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#3ab065b11a52d3e2e6a50a25459f9ff0aac03b13", "lbry-redux": "lbryio/lbry-redux#00755bef2eaef739a44dc0ad66bd5dece50497ac",
"lbryinc": "lbryio/lbryinc#2334ad53e82c22d6291899785d5292347008f2a9", "lbryinc": "lbryio/lbryinc#2334ad53e82c22d6291899785d5292347008f2a9",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"mammoth": "^1.4.6", "mammoth": "^1.4.6",
@ -98,6 +100,7 @@
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.18.0", "babel-preset-stage-2": "^6.18.0",
"copy-webpack-plugin": "^4.6.0",
"decompress": "^4.2.0", "decompress": "^4.2.0",
"del": "^3.0.0", "del": "^3.0.0",
"devtron": "^1.4.0", "devtron": "^1.4.0",
@ -130,7 +133,6 @@
"sass-loader": "^6.0.7", "sass-loader": "^6.0.7",
"webpack": "^3.10.0", "webpack": "^3.10.0",
"webpack-build-notifier": "^0.1.23", "webpack-build-notifier": "^0.1.23",
"webpack-cli": "^2.0.0",
"yarnhook": "^0.2.0" "yarnhook": "^0.2.0"
}, },
"engines": { "engines": {

View file

@ -119,7 +119,9 @@ class App extends React.PureComponent<Props> {
src={Native.imagePath('gerbil-happy.png')} src={Native.imagePath('gerbil-happy.png')}
/> />
)} )}
{/* @if TARGET='app' */}
<SideBar /> <SideBar />
{/* @endif */}
<div className="content" id="content"> <div className="content" id="content">
<Router /> <Router />
<ModalRouter /> <ModalRouter />

View file

@ -80,10 +80,7 @@ const Header = (props: Props) => {
<WunderBar /> <WunderBar />
{ {/* @if TARGET='app' */}
// TODO: Make `Menu` add `.active` class to `.navigation` when clicked
}
<div className="header__navigation"> <div className="header__navigation">
<Button <Button
className="header__navigation-item header__navigation-item--menu" className="header__navigation-item header__navigation-item--menu"
@ -111,6 +108,7 @@ const Header = (props: Props) => {
/> />
)} )}
</div> </div>
{/* @endif */}
</header> </header>
); );
}; };

View file

@ -126,20 +126,19 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
// If the wallet is locked, stop doing anything and make the user input their password // If the wallet is locked, stop doing anything and make the user input their password
// @if TARGET='app' // xxxif TARGET='app'
if (wallet && wallet.is_locked) { if (wallet && wallet.is_locked) {
// Clear the error timeout, it might sit on this step for a while until someone enters their password // Clear the error timeout, it might sit on this step for a while until someone enters their password
if (this.timeout) { if (this.timeout) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
// @endif // xxxendif
// @if TARGET='web' // xxxif TARGET='web'
console.log('I think web needs this', accountList); // if (accountList && accountList.encrypted) {
// if (account_list && account_list.encrypted) {
// this.setState({ // this.setState({
// isRunning: true, // isRunning: true,
// }); // });
// @endif // xxxendif
// Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON) // Make sure there isn't another active modal (like INCOMPATIBLE_DAEMON)
if (launchedModal === false && !modal) { if (launchedModal === false && !modal) {
@ -148,7 +147,7 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
} else if (status.is_running) { } else if (status.is_running) {
// If we cleared the error timout due to a wallet being locked, make sure to start it back up // If we cleared the error timout due to a wallet being locked, make sure to start it back up
if (!this.timeout) { if (!this.timeout) {
this.adjustErrorTimeout(); this.adjustErrorTimseout();
} }
Lbry.resolve({ urls: 'lbry://one' }).then(() => { Lbry.resolve({ urls: 'lbry://one' }).then(() => {

View file

@ -19,7 +19,13 @@ import {
doOpenModal, doOpenModal,
doHideModal, doHideModal,
} from 'redux/actions/app'; } from 'redux/actions/app';
import { doToast, doBlackListedOutpointsSubscribe, isURIValid, setSearchApi } from 'lbry-redux'; import {
Lbry,
doToast,
doBlackListedOutpointsSubscribe,
isURIValid,
setSearchApi,
} from 'lbry-redux';
import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation'; import { doNavigate, doHistoryBack, doHistoryForward } from 'redux/actions/navigation';
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings'; import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
import { doAuthenticate, Lbryio, rewards } from 'lbryinc'; import { doAuthenticate, Lbryio, rewards } from 'lbryinc';
@ -45,6 +51,7 @@ if (process.env.SEARCH_API_URL) {
setSearchApi(process.env.SEARCH_API_URL); setSearchApi(process.env.SEARCH_API_URL);
} }
// @if TARGET='app'
ipcRenderer.on('navigate-backward', () => { ipcRenderer.on('navigate-backward', () => {
app.store.dispatch(doHistoryBack()); app.store.dispatch(doHistoryBack());
}); });
@ -52,6 +59,12 @@ ipcRenderer.on('navigate-backward', () => {
ipcRenderer.on('navigate-forward', () => { ipcRenderer.on('navigate-forward', () => {
app.store.dispatch(doHistoryForward()); app.store.dispatch(doHistoryForward());
}); });
// @endif
// @if TARGET='web'
Lbry.setDaemonConnectionString('/api/proxy');
console.log('set string');
// @endif
// We need to override Lbryio for getting/setting the authToken // We need to override Lbryio for getting/setting the authToken
// We interect with ipcRenderer to get the auth key from a users keyring // We interect with ipcRenderer to get the auth key from a users keyring

View file

@ -13,7 +13,9 @@ import { remote } from 'web/stubs';
// @endif // @endif
/* eslint-enable no-redeclare */ /* eslint-enable no-redeclare */
// @if TARGET='app'
const win = remote.BrowserWindow.getFocusedWindow(); const win = remote.BrowserWindow.getFocusedWindow();
// @endif
const reducers = {}; const reducers = {};
@ -173,7 +175,9 @@ reducers[ACTIONS.DOWNLOADING_COMPLETED] = state => {
const { badgeNumber } = state; const { badgeNumber } = state;
// Don't update the badge number if the window is focused // Don't update the badge number if the window is focused
// @if TARGET='app'
if (win && win.isFocused()) return Object.assign({}, state); if (win && win.isFocused()) return Object.assign({}, state);
// @endif
return Object.assign({}, state, { return Object.assign({}, state, {
badgeNumber: badgeNumber + 1, badgeNumber: badgeNumber + 1,

View file

@ -1,35 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>LBRY</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600italic,600' rel='stylesheet' type='text/css'>
<link href="./css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="icon" type="image/png" href="img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/fav/favicon-16x16.png" sizes="16x16">
<meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/img/fav/mstile-144x144.png">
<meta name="theme-color" content="#155B4A">
<style>
body {
background-color: "#155b4a"
}
</style>
</head>
<div id="canvas">
<div class="load-screen" style="color: white; min-height: 100vh; min-width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img src="img/lbry-white-485x160.png" alt="LBRY">
<div style="margin-top: 24px; width: 325px; text-align: center;">
<h3>
<span>Shutting Down <span class="busy-indicator"></span>
</span>
</h3>
</div>
</div>
</div>
</html>

View file

@ -1 +0,0 @@
lbrynet>=0.8.4

View file

@ -1,35 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>LBRY</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600italic,600' rel='stylesheet' type='text/css'>
<link href="./css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="icon" type="image/png" href="img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/fav/favicon-16x16.png" sizes="16x16">
<meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/img/fav/mstile-144x144.png">
<meta name="theme-color" content="#155B4A">
<style>
body {
background-color: "#155b4a"
}
</style>
</head>
<div id="canvas">
<div class="load-screen" style="color: white; min-height: 100vh; min-width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img src="img/lbry-white-485x160.png" alt="LBRY">
<div style="margin-top: 24px; width: 325px; text-align: center;">
<h3>
<span>Starting LBRY Upgrade <span class="busy-indicator"></span>
</span>
</h3>
</div>
</div>
</div>
</html>

View file

@ -1,35 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>LBRY</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600italic,600' rel='stylesheet' type='text/css'>
<link href="./css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="icon" type="image/png" href="img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="img/fav/favicon-16x16.png" sizes="16x16">
<meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/img/fav/mstile-144x144.png">
<meta name="theme-color" content="#155B4A">
<style>
body {
background-color: "#155b4a"
}
</style>
</head>
<div id="canvas">
<div class="load-screen" style="color: white; min-height: 100vh; min-width: 100vw; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<img src="img/lbry-white-485x160.png" alt="LBRY">
<div style="margin-top: 24px; width: 325px; text-align: center;">
<h3>
<span>The daemon has unexpectedly shutdown. Goodbye.
</span>
</h3>
</div>
</div>
</div>
</html>

View file

@ -1,6 +1,9 @@
const path = require('path'); const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ELECTRON_RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/'); const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
const RENDERER_PROCESS_ROOT = path.resolve(__dirname, 'src/renderer/');
module.exports = env => { module.exports = env => {
return { return {
@ -12,10 +15,6 @@ module.exports = env => {
filename: 'bundle.js', filename: 'bundle.js',
publicPath: '/static/app/', publicPath: '/static/app/',
}, },
// commented out because of webpack 3
// optimization: {
// minimize: false,
// },
target: 'web', target: 'web',
node: { node: {
fs: 'empty', fs: 'empty',
@ -50,14 +49,6 @@ module.exports = env => {
], ],
exclude: /node_modules/, exclude: /node_modules/,
}, },
// {
// test: /\.jsx?$/,
// loader: 'babel-loader',
// options: {
// presets: ['env', 'react', 'stage-2'],
// },
// exclude: /node_modules/,
// },
{ {
test: /\.scss$/, test: /\.scss$/,
use: [ use: [
@ -67,14 +58,26 @@ module.exports = env => {
], ],
}, },
{ {
test: /\.(png|woff|woff2|eot|ttf|svg|gif)$/, test: /\.(woff|woff2)$/,
// loader: 'url-loader?limit=100000'
use: [ use: [
{ {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: '[name].[ext]', name: '[name].[ext]',
// outputPath: 'resources/' outputPath: 'static/font/',
},
},
],
},
{
// All images should use this, but we need to bring them into components
test: /\.(gif|png)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'static/img/',
}, },
}, },
], ],
@ -86,9 +89,18 @@ module.exports = env => {
], ],
}, },
resolve: { resolve: {
modules: [ELECTRON_RENDERER_PROCESS_ROOT, 'node_modules', __dirname], modules: [RENDERER_PROCESS_ROOT, 'node_modules', __dirname],
extensions: ['.js', '.jsx', '.scss', '.json'], extensions: ['.js', '.jsx', '.scss', '.json'],
}, },
plugins: [
new CopyWebpackPlugin([
{
from: `${STATIC_ROOT}/`,
to: `${DIST_ROOT}/web/static/`,
ignore: ['daemon/**/*', 'font/**/*'],
},
]),
],
externals: [ externals: [
(function() { (function() {
var IGNORES = [ var IGNORES = [

1190
yarn.lock

File diff suppressed because it is too large Load diff