Merge pull request #784 from lbryio/revert-783-restructuring

Revert "Update file structure to follow electron-webpack guidelines"
This commit is contained in:
Jeremy Kauffman 2017-11-24 16:36:34 -05:00 committed by GitHub
commit c66c600b89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
338 changed files with 670 additions and 749 deletions

View file

@ -16,11 +16,11 @@ values =
rc
production
[bumpversion:file:src/main/package.json]
[bumpversion:file:app/package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"
[bumpversion:file:src/renderer/package.json]
[bumpversion:file:ui/package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

16
.gitignore vendored
View file

@ -2,16 +2,16 @@
/LBRY-darwin-x64
/dist
/src/renderer/dist/css/*
/src/renderer/dist/js/*
!/src/renderer/dist/js/mediaelement
/src/renderer/node_modules
/src/renderer/.sass-cache
/ui/dist/css/*
/ui/dist/js/*
!/ui/dist/js/mediaelement
/ui/node_modules
/ui/.sass-cache
/src/main/dist
/src/main/locales
/src/main/node_modules
/app/dist
/app/locales
/app/node_modules
/build/venv
/build/daemon.ver
/lbry-app-venv

View file

@ -2,7 +2,7 @@
host = https://www.transifex.com
[lbry-app.app-strings]
file_filter = src/main/dist/locales/<lang>.json
source_file = src/main/dist/locales/en.json
file_filter = app/dist/locales/<lang>.json
source_file = app/dist/locales/en.json
source_lang = en
type = KEYVALUEJSON

View file

@ -29,13 +29,13 @@ This will download and install the LBRY app and its dependencies, including [the
### Running
Run `./node_modules/.bin/electron src/main`
Run `./node_modules/.bin/electron app`
### Ongoing Development
1. `cd src/renderer`
1. `cd ui`
2. `./watch.sh`
This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `src/renderer` folder. This allows you to make changes and see them immediately by reloading the app.
This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app.
### Packaging
@ -67,36 +67,36 @@ python build\set_version.py
npm install -g yarn
yarn install
```
3. Change directory to `src\main` and run the following;
3. Change directory to `app` and run the following;
```
yarn install
node_modules\.bin\electron-rebuild
node_modules\.bin\electron-rebuild
cd ..\..
cd ..
```
4. Change directory to `src\renderer` and run the following:
4. Change directory to `ui` and run the following:
```
yarn install
npm rebuild node-sass
node node_modules\node-sass\bin\node-sass --output dist\css --sourcemap=none scss\
node_modules\.bin\webpack --config webpack.dev.config.js
xcopy /E dist ..\main\dist
cd ..\..
xcopy /E dist ..\app\dist
cd ..
```
4. Download the lbry daemon and cli [binaries](https://github.com/lbryio/lbry/releases) and place them in `src\main\dist\`
4. Download the lbry daemon and cli [binaries](https://github.com/lbryio/lbry/releases) and place them in `app\dist\`
### Building lbry-app
1. run `node_modules\.bin\build -p never` from the root of the project.
### Running the electron app
1. Run `node_modules\.bin\electron src\main`
1. Run `node_modules\.bin\electron app`
### Ongoing Development
1. `cd src\renderer`
1. `cd ui`
2. `watch.bat`
This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `src\renderer` folder. This allows you to make changes and see them immediately by reloading the app.
This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app.
## Internationalization
If you want to help translating the lbry-app, you can copy the en.json file in /src/main/locales and modify the values while leaving the keys as their original English strings. An example for this would be: `"Skip": "Überspringen",` Translations should automatically show up in options.
If you want to help translating the lbry-app, you can copy the en.json file in /app/locales and modify the values while leaving the keys as their original English strings. An example for this would be: `"Skip": "Überspringen",` Translations should automatically show up in options.

View file

@ -9,33 +9,33 @@ yarn install
# do app
cd src\main
cd app
yarn install
# necessary to ensure native Node modules (e.g. keytar) are built against the correct version of Node)
# yes, it needs to be run twice. it fails the first time, not sure why
node_modules\.bin\electron-rebuild
node_modules\.bin\electron-rebuild
cd ..\..
cd ..
# build ui
cd main\renderer
cd ui
yarn install
npm rebuild node-sass
node_modules\.bin\node-sass --output dist\css --sourcemap=none scss\
node_modules\.bin\webpack --config webpack.prod.js
Copy-Item dist ..\main\ -recurse
cd ..\..
Copy-Item dist ..\app\ -recurse
cd ..
# get daemon and cli executable
$package_settings = (Get-Content src\main\package.json -Raw | ConvertFrom-Json).lbrySettings
$package_settings = (Get-Content app\package.json -Raw | ConvertFrom-Json).lbrySettings
$daemon_ver = $package_settings.lbrynetDaemonVersion
$daemon_url_template = $package_settings.lbrynetDaemonUrlTemplate
$daemon_url = $daemon_url_template.Replace('OSNAME', 'windows').Replace('DAEMONVER', $daemon_ver)
Invoke-WebRequest -Uri $daemon_url -OutFile daemon.zip
Expand-Archive daemon.zip -DestinationPath src\main\dist\
dir src\main\dist\ # verify that daemon binary is there
Expand-Archive daemon.zip -DestinationPath app\dist\
dir app\dist\ # verify that daemon binary is there
rm daemon.zip

View file

@ -41,8 +41,8 @@ fi
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
mkdir -p "$ROOT/dist"
[ -d "$ROOT/src/main/dist" ] && rm -rf "$ROOT/src/main/dist"
mkdir -p "$ROOT/src/main/dist"
[ -d "$ROOT/app/dist" ] && rm -rf "$ROOT/app/dist"
mkdir -p "$ROOT/app/dist"
yarn install
@ -53,13 +53,13 @@ yarn install
############
echo -e "\033[0;32mCompiling UI\x1b[m"
(
cd "$ROOT/src/renderer"
cd "$ROOT/ui"
yarn install
npm rebuild node-sass
node extractLocals.js
node_modules/.bin/node-sass --output dist/css --sourcemap=none scss/
node_modules/.bin/webpack --config webpack.prod.js
cp -r dist/* "$ROOT/src/main/dist/"
cp -r dist/* "$ROOT/app/dist/"
)
@ -73,14 +73,14 @@ if $OSX; then
else
OSNAME="linux"
fi
DAEMON_VER=$(node -e "console.log(require(\"$ROOT/src/main/package.json\").lbrySettings.lbrynetDaemonVersion)")
DAEMON_URL_TEMPLATE=$(node -e "console.log(require(\"$ROOT/src/main/package.json\").lbrySettings.lbrynetDaemonUrlTemplate)")
DAEMON_VER=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonVersion)")
DAEMON_URL_TEMPLATE=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonUrlTemplate)")
DAEMON_URL=$(echo ${DAEMON_URL_TEMPLATE//DAEMONVER/$DAEMON_VER} | sed "s/OSNAME/$OSNAME/g")
DAEMON_VER_PATH="$BUILD_DIR/daemon.ver"
echo "$DAEMON_VER_PATH"
if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/src/main/dist/lbrynet-daemon || "$(< "$DAEMON_VER_PATH")" != "$DAEMON_VER" ]]; then
if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/app/dist/lbrynet-daemon || "$(< "$DAEMON_VER_PATH")" != "$DAEMON_VER" ]]; then
curl -sL -o "$BUILD_DIR/daemon.zip" "$DAEMON_URL"
unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/src/main/dist/"
unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/"
rm "$BUILD_DIR/daemon.zip"
echo "$DAEMON_VER" > "$DAEMON_VER_PATH"
else
@ -95,16 +95,16 @@ fi
###################
echo -e '\033[0;32mBuilding Lbry-app\x1b[m'
(
cd "$ROOT/src/main"
cd "$ROOT/app"
yarn install
# necessary to ensure native Node modules (e.g. keytar) are built against the correct version of Node)
# yes, it needs to be run twice. it fails the first time, not sure why
set +e
# DEBUG=electron-rebuild node_modules/.bin/electron-rebuild .
node_modules/.bin/electron-rebuild "$ROOT/src/main"
node_modules/.bin/electron-rebuild "$ROOT/app"
set -e
node_modules/.bin/electron-rebuild "$ROOT/src/main"
node_modules/.bin/electron-rebuild "$ROOT/app"
)
if [ "$FULL_BUILD" == "true" ]; then
@ -133,5 +133,5 @@ if [ "$FULL_BUILD" == "true" ]; then
echo -e '\033[0;32mBuild and packaging complete.\x1b[m'
else
echo -e 'Build complete. Run \033[1;31m./node_modules/.bin/electron src/main\x1b[m to launch the app'
echo -e 'Build complete. Run \033[1;31m./node_modules/.bin/electron app\x1b[m to launch the app'
fi

View file

@ -17,7 +17,7 @@ import github
import changelog
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
APP_PACKAGE_JSON_FILE = os.path.join(ROOT, 'src', 'main', 'package.json')
APP_PACKAGE_JSON_FILE = os.path.join(ROOT, 'app', 'package.json')
def main():

View file

@ -3,7 +3,7 @@
"build": {
"asar": false,
"directories": {
"app": "src/main"
"app": "app"
},
"appId": "io.lbry.LBRY",
"mac": {

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

View file

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 992 KiB

After

Width:  |  Height:  |  Size: 992 KiB

View file

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View file

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,7 +1,7 @@
var extract = require("i18n-extract");
const fs = require("fs");
var dir = __dirname + "/../main/dist/locales";
var dir = __dirname + "/../app/dist/locales";
var path = dir + "/en.json";
if (!fs.existsSync(dir)) {

View file

@ -40,19 +40,16 @@ class ChannelTile extends React.PureComponent {
</h3>
</div>
<div className="card__content card__subtext">
{isResolvingUri && (
<BusyMessage message={__("Resolving channel")} />
)}
{totalItems > 0 && (
{isResolvingUri &&
<BusyMessage message={__("Resolving channel")} />}
{totalItems > 0 &&
<span>
This is a channel with {totalItems}{" "}
{totalItems === 1 ? " item" : " items"} inside of it.
</span>
)}
</span>}
{!isResolvingUri &&
!totalItems && (
<span className="empty">This is an empty channel.</span>
)}
!totalItems &&
<span className="empty">This is an empty channel.</span>}
</div>
</div>
</div>

View file

@ -50,9 +50,7 @@ export class BusyMessage extends React.PureComponent {
render() {
return (
<span>
{this.props.message} <span className="busy-indicator" />
</span>
<span>{this.props.message} <span className="busy-indicator" /></span>
);
}
}
@ -94,8 +92,7 @@ export class CreditAmount extends React.PureComponent {
if (showFullPrice) {
formattedAmount = fullPrice;
} else {
formattedAmount =
amount > 0 && amount < minimumRenderableAmount
formattedAmount = amount > 0 && amount < minimumRenderableAmount
? "<" + minimumRenderableAmount
: formatCredits(amount, precision);
}
@ -122,15 +119,17 @@ export class CreditAmount extends React.PureComponent {
className={`credit-amount credit-amount--${this.props.look}`}
title={fullPrice}
>
<span>{amountText}</span>
{this.props.isEstimate ? (
<span
<span>
{amountText}
</span>
{this.props.isEstimate
? <span
className="credit-amount__estimate"
title={__("This is an estimate and does not include data fees")}
>
*
</span>
) : null}
: null}
</span>
);
}

View file

@ -26,8 +26,7 @@ class FileSelector extends React.PureComponent {
handleButtonClick() {
remote.dialog.showOpenDialog(
{
properties:
this.props.type == "file"
properties: this.props.type == "file"
? ["openFile"]
: ["openDirectory", "createDirectory"],
},
@ -63,7 +62,8 @@ class FileSelector extends React.PureComponent {
: __("Choose Directory")}
</span>
</span>
</button>{" "}
</button>
{" "}
<span className="file-selector__path">
<input
className="input-copyable"

View file

@ -13,24 +13,22 @@ class FileActions extends React.PureComponent {
return (
<section className="card__actions">
<FileDownloadLink uri={uri} />
{showDelete && (
{showDelete &&
<Link
button="text"
icon="icon-trash"
label={__("Remove")}
className="no-underline"
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
/>
)}
{!claimIsMine && (
/>}
{!claimIsMine &&
<Link
button="text"
icon="icon-flag"
href={`https://lbry.io/dmca?claim_id=${claimId}`}
className="no-underline"
label={__("report")}
/>
)}
/>}
<Link
button="primary"
icon="icon-gift"
@ -39,7 +37,7 @@ class FileActions extends React.PureComponent {
className="card__action--right"
navigateParams={{ uri, tab: "tip" }}
/>
{claimIsMine && (
{claimIsMine &&
<Link
button="alt"
icon="icon-edit"
@ -47,8 +45,7 @@ class FileActions extends React.PureComponent {
navigate="/publish"
className="card__action--right"
navigateParams={{ id: claimId }}
/>
)}
/>}
</section>
);
}

View file

@ -49,18 +49,15 @@ class FileDetails extends React.PureComponent {
<table className="table-standard table-stretch">
<tbody>
<tr>
<td>{__("Content-Type")}</td>
<td>{mediaType}</td>
<td>{__("Content-Type")}</td><td>{mediaType}</td>
</tr>
<tr>
<td>{__("Language")}</td>
<td>{language}</td>
<td>{__("Language")}</td><td>{language}</td>
</tr>
<tr>
<td>{__("License")}</td>
<td>{license}</td>
<td>{__("License")}</td><td>{license}</td>
</tr>
{downloadPath && (
{downloadPath &&
<tr>
<td>{__("Downloaded to")}</td>
<td>
@ -68,8 +65,7 @@ class FileDetails extends React.PureComponent {
{downloadPath}
</Link>
</td>
</tr>
)}
</tr>}
</tbody>
</table>
</div>

View file

@ -45,8 +45,7 @@ class FileDownloadLink extends React.PureComponent {
} = this.props;
if (loading || downloading) {
const progress =
fileInfo && fileInfo.written_bytes
const progress = fileInfo && fileInfo.written_bytes
? fileInfo.written_bytes / fileInfo.total_bytes * 100
: 0,
label = fileInfo
@ -55,7 +54,9 @@ class FileDownloadLink extends React.PureComponent {
labelWithIcon = (
<span className="button__content">
<Icon icon="icon-download" />
<span>{label}</span>
<span>
{label}
</span>
</span>
);

View file

@ -98,7 +98,7 @@ class FileList extends React.PureComponent {
<section className="file-list__header">
{fetching && <BusyMessage />}
<span className="sort-section">
{__("Sort by")}{" "}
{__("Sort by")} {" "}
<FormField type="select" onChange={this.handleSortChanged.bind(this)}>
<option value="date">{__("Date")}</option>
<option value="title">{__("Title")}</option>

View file

@ -11,7 +11,7 @@ const SearchNoResults = props => {
return (
<section>
<span className="empty">
{(__("No one has checked anything in for %s yet."), query)}{" "}
{(__("No one has checked anything in for %s yet."), query)} {" "}
<Link label={__("Be the first")} navigate="/publish" />
</span>
</section>
@ -39,21 +39,19 @@ class FileListSearch extends React.PureComponent {
return (
<div>
{isSearching &&
!uris && (
<BusyMessage message={__("Looking up the Dewey Decimals")} />
)}
!uris &&
<BusyMessage message={__("Looking up the Dewey Decimals")} />}
{isSearching &&
uris && <BusyMessage message={__("Refreshing the Dewey Decimals")} />}
uris &&
<BusyMessage message={__("Refreshing the Dewey Decimals")} />}
{uris && uris.length
? uris.map(
uri =>
lbryuri.parse(uri).name[0] === "@" ? (
<ChannelTile key={uri} uri={uri} />
) : (
<FileTile key={uri} uri={uri} />
)
lbryuri.parse(uri).name[0] === "@"
? <ChannelTile key={uri} uri={uri} />
: <FileTile key={uri} uri={uri} />
)
: !isSearching && <SearchNoResults query={query} />}
</div>

View file

@ -72,12 +72,12 @@ class FileTile extends React.PureComponent {
const uri = lbryuri.normalize(this.props.uri);
const isClaimed = !!claim;
const isClaimable = lbryuri.isClaimable(uri);
const title =
isClaimed && metadata && metadata.title
const title = isClaimed && metadata && metadata.title
? metadata.title
: lbryuri.parse(uri).contentName;
const thumbnail =
metadata && metadata.thumbnail ? metadata.thumbnail : null;
const thumbnail = metadata && metadata.thumbnail
? metadata.thumbnail
: null;
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
const isRewardContent =
claim && rewardedContentClaimIds.includes(claim.claim_id);
@ -98,10 +98,9 @@ class FileTile extends React.PureComponent {
onClick = () => navigate("/publish", {});
description = (
<span className="empty">
{__("This location is unused.")}{" "}
{isClaimable && (
<span className="button-text">{__("Put something here!")}</span>
)}
{__("This location is unused.")} {" "}
{isClaimable &&
<span className="button-text">{__("Put something here!")}</span>}
</span>
);
} else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) {
@ -124,21 +123,22 @@ class FileTile extends React.PureComponent {
<div className="file-tile__content">
<div className="card__title-primary">
<span className="card__indicators">
{showPrice && <FilePrice uri={this.props.uri} />}{" "}
{isRewardContent && <Icon icon={icons.FEATURED} />}{" "}
{showPrice && <FilePrice uri={this.props.uri} />}
{" "}
{isRewardContent && <Icon icon={icons.FEATURED} />}
{" "}
{showLocal && fileInfo && <Icon icon={icons.LOCAL} />}
</span>
<h3>
<TruncatedText lines={1}>{title || name}</TruncatedText>
</h3>
</div>
{description && (
{description &&
<div className="card__content card__subtext">
<TruncatedText lines={!showActions ? 3 : 2}>
{description}
</TruncatedText>
</div>
)}
</div>}
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show more