Overall clean-up and improvement of the project #5
12 changed files with 4273 additions and 6673 deletions
4
.babelrc
Normal file
4
.babelrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"presets": ["env", "stage-2"],
|
||||
"plugins": ["transform-flow-comments"]
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"plugins": ["flowtype"],
|
||||
"extends": [
|
||||
"airbnb",
|
||||
"airbnb-base",
|
||||
"plugin:import/electron",
|
||||
"plugin:flowtype/recommended",
|
||||
"plugin:prettier/recommended"
|
||||
|
|
9
.flowconfig
Normal file
9
.flowconfig
Normal file
|
@ -0,0 +1,9 @@
|
|||
[ignore]
|
||||
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
|
||||
[options]
|
||||
module.system.node.resolve_dirname=src
|
||||
module.system.node.resolve_dirname=node_modules
|
30
.gitignore
vendored
30
.gitignore
vendored
|
@ -1,30 +1,2 @@
|
|||
/node_modules
|
||||
/LBRY-darwin-x64
|
||||
/dist
|
||||
|
||||
/src/main/dist
|
||||
/src/main/locales
|
||||
/src/main/node_modules
|
||||
/src/renderer/dist
|
||||
/build/venv
|
||||
/build/daemon.ver
|
||||
/lbry-app-venv
|
||||
/lbry-app
|
||||
/lbry-venv
|
||||
/static/daemon/lbrynet*
|
||||
/static/locales
|
||||
/daemon/build
|
||||
/daemon/venv
|
||||
/daemon/requirements.txt
|
||||
/.idea
|
||||
|
||||
*.pyc
|
||||
*.iml
|
||||
.#*
|
||||
|
||||
build/daemon.zip
|
||||
.vimrc
|
||||
|
||||
package-lock.json
|
||||
|
||||
.DS_Store
|
||||
yarn-error.log
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"linters": {
|
||||
"src/**/*.js": [
|
||||
"src/**/*.{js,json}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
],
|
||||
"src/**/*.js": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
5649
build/index.js → dist/bundle.js
vendored
5649
build/index.js → dist/bundle.js
vendored
File diff suppressed because it is too large
Load diff
80
package.json
80
package.json
|
@ -2,6 +2,10 @@
|
|||
"name": "lbry-redux",
|
||||
"version": "0.0.1",
|
||||
"description": "Common shared components for desktop and mobile.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
],
|
||||
"license": "MIT",
|
||||
"homepage": "https://lbry.io/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/lbryio/lbry-redux/issues"
|
||||
|
@ -14,79 +18,41 @@
|
|||
"name": "LBRY Inc.",
|
||||
"email": "hello@lbry.io"
|
||||
},
|
||||
"main": "build/index.js",
|
||||
"main": "dist/bundle.js",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"precommit": "lint-staged",
|
||||
"lint": "eslint 'src/**/*.{js,jsx}' --fix",
|
||||
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write"
|
||||
"lint": "eslint 'src/**/*.js' --fix",
|
||||
"format": "prettier 'src/**/*.{js,json}' --write"
|
||||
},
|
||||
"keywords": [
|
||||
"lbry"
|
||||
],
|
||||
"dependencies": {
|
||||
"amplitude-js": "^4.0.0",
|
||||
"bluebird": "^3.5.1",
|
||||
"classnames": "^2.2.5",
|
||||
"electron-dl": "^1.6.0",
|
||||
"from2": "^2.3.0",
|
||||
"install": "^0.10.2",
|
||||
"jayson": "^2.0.2",
|
||||
"jshashes": "^1.0.7",
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"rc-progress": "^2.0.6",
|
||||
"react": "^16.2.0",
|
||||
"react-redux": "^5.0.3",
|
||||
"redux": "^3.6.0",
|
||||
"redux-action-buffer": "^1.1.0",
|
||||
"redux-logger": "^3.0.1",
|
||||
"redux-persist": "^4.8.0",
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.10",
|
||||
"reselect": "^3.0.0",
|
||||
"semver": "^5.3.0",
|
||||
"tree-kill": "^1.1.0",
|
||||
"y18n": "^4.0.0"
|
||||
"proxy-polyfill": "^0.2.0",
|
||||
"reselect": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-eslint": "^8.0.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-plugin-module-resolver": "^3.0.0",
|
||||
"babel-plugin-react-require": "^3.0.0",
|
||||
"babel-polyfill": "^6.20.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.18.0",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "^1.7.9",
|
||||
"electron-builder": "^19.49.0",
|
||||
"electron-devtools-installer": "^2.2.1",
|
||||
"electron-webpack": "^1.11.0",
|
||||
"eslint": "^4.13.1",
|
||||
"eslint-config-airbnb": "^16.1.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-airbnb-base": "^12.1.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-import-resolver-webpack": "^0.8.3",
|
||||
"eslint-import-resolver-webpack": "^0.9.0",
|
||||
"eslint-plugin-flowtype": "^2.40.1",
|
||||
"eslint-plugin-import": "^2.8.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.0.3",
|
||||
"eslint-plugin-import": "^2.10.0",
|
||||
"eslint-plugin-prettier": "^2.4.0",
|
||||
"eslint-plugin-react": "^7.5.1",
|
||||
"flow-babel-webpack-plugin": "^1.1.0",
|
||||
"flow-bin": "^0.61.0",
|
||||
"flow-typed": "^2.2.3",
|
||||
"flow-babel-webpack-plugin": "^1.1.1",
|
||||
"flow-bin": "^0.69.0",
|
||||
"flow-typed": "^2.4.0",
|
||||
"husky": "^0.14.3",
|
||||
"i18n-extract": "^0.5.1",
|
||||
"json-loader": "^0.5.4",
|
||||
"lint-staged": "^6.0.0",
|
||||
"node-loader": "^0.6.0",
|
||||
"node-sass": "^4.7.2",
|
||||
"lint-staged": "^7.0.4",
|
||||
"prettier": "^1.4.2",
|
||||
"sass-loader": "^6.0.6",
|
||||
"webpack": "^3.10.0",
|
||||
"webpack-build-notifier": "^0.1.18"
|
||||
"webpack": "^4.5.0",
|
||||
"webpack-cli": "^2.0.14"
|
||||
},
|
||||
"license": "MIT",
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.18.0",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip"
|
||||
"engines": {
|
||||
"yarn": "^1.3"
|
||||
}
|
||||
}
|
||||
|
|
12
src/lbry.js
12
src/lbry.js
|
@ -49,16 +49,6 @@ function apiCall(method: string, params: ?{}, resolve: Function, reject: Functio
|
|||
.catch(reject);
|
||||
}
|
||||
|
||||
function getLocal(key, fallback = undefined) {
|
||||
// const itemRaw = localStorage.getItem(key);
|
||||
const itemRaw = null;
|
||||
return itemRaw === null ? fallback : JSON.parse(itemRaw);
|
||||
}
|
||||
|
||||
function setLocal(key, value) {
|
||||
// localStorage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
// core
|
||||
Lbry.status = () =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
@ -141,8 +131,6 @@ Lbry.getMediaType = (contentType, fileName) => {
|
|||
*/
|
||||
Lbry.file_list = (params = {}) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const { claim_name: claimName, channel_name: channelName, outpoint } = params;
|
||||
|
||||
apiCall(
|
||||
'file_list',
|
||||
params,
|
||||
|
|
|
@ -69,18 +69,6 @@ export const doSearch = rawQuery => (dispatch, getState) => {
|
|||
});
|
||||
};
|
||||
|
||||
export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_SEARCH_QUERY,
|
||||
data: { query },
|
||||
});
|
||||
|
||||
// Don't fetch new suggestions if the user just added a space
|
||||
if (!query.endsWith(' ') || !shouldSkipSuggestions) {
|
||||
dispatch(getSearchSuggestions(query));
|
||||
}
|
||||
};
|
||||
|
||||
export const getSearchSuggestions = (value: string) => dispatch => {
|
||||
const query = value.trim();
|
||||
|
||||
|
@ -121,7 +109,7 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
|||
);
|
||||
|
||||
// If it's a valid url, don't fetch any extra search results
|
||||
return dispatch({
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_SEARCH_SUGGESTIONS,
|
||||
data: { suggestions },
|
||||
});
|
||||
|
@ -146,7 +134,7 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
|||
searchValue = searchValue.substring(0, searchValue.indexOf('#'));
|
||||
}
|
||||
|
||||
return fetch(`https://lighthouse.lbry.io/autocomplete?s=${searchValue}`)
|
||||
fetch(`https://lighthouse.lbry.io/autocomplete?s=${searchValue}`)
|
||||
.then(handleFetchResponse)
|
||||
.then(apiSuggestions => {
|
||||
const formattedSuggestions = apiSuggestions.slice(0, 6).map(suggestion => {
|
||||
|
@ -172,3 +160,15 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
|||
// Basic search suggestions are already populated at this point
|
||||
});
|
||||
};
|
||||
|
||||
export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_SEARCH_QUERY,
|
||||
data: { query },
|
||||
});
|
||||
|
||||
// Don't fetch new suggestions if the user just added a space
|
||||
if (!query.endsWith(' ') || !shouldSkipSuggestions) {
|
||||
dispatch(getSearchSuggestions(query));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ export function doUpdateBalance() {
|
|||
const { wallet: { balance: balanceInStore } } = getState();
|
||||
Lbry.wallet_balance().then(balance => {
|
||||
if (balanceInStore !== balance) {
|
||||
return dispatch({
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_BALANCE,
|
||||
data: {
|
||||
balance,
|
||||
|
|
|
@ -1,31 +1,25 @@
|
|||
/* eslint-disable import/no-commonjs */
|
||||
const path = require('path');
|
||||
const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'none',
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: 'index.js',
|
||||
libraryTarget: 'umd'
|
||||
filename: 'bundle.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: path.resolve(__dirname, 'src'),
|
||||
exclude: /(node_modules|bower_components|build)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['env', 'react', 'stage-2']
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
modules: [path.resolve(__dirname, 'src/'), 'node_modules', __dirname],
|
||||
extensions: ['.js', '.jsx', '.scss'],
|
||||
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
|
||||
},
|
||||
externals: {
|
||||
'react': 'commonjs react'
|
||||
}
|
||||
plugins: [new FlowBabelWebpackPlugin()],
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue