Merge branch 'yarn'

* yarn:
  forgot to edit appveyor build
  move keytar into main app process, so webpack doesnt package it and fuck up the keytar.node path
  switch to yarn
  devtron
This commit is contained in:
Alex Grintsvayg 2017-06-26 13:09:24 -04:00
commit ada379f873
14 changed files with 8961 additions and 44 deletions

View file

@ -3,13 +3,21 @@ const url = require('url');
const isDebug = process.env.NODE_ENV === 'development'
if (isDebug) {
require('electron-debug')({showDevTools: true});
try
{
require('electron-debug')({showDevTools: true});
}
catch (err) // electron-debug is in devDependencies, but some
{
console.error(err)
}
}
const path = require('path');
const jayson = require('jayson');
const semver = require('semver');
const https = require('https');
const keytar = require('keytar');
// tree-kill has better cross-platform handling of
// killing a process. child-process.kill was unreliable
const kill = require('tree-kill');
@ -389,3 +397,13 @@ if (process.platform == 'darwin') {
win.webContents.send('open-uri-requested', denormalizeUri(process.argv[1]));
}
}
ipcMain.on('get-auth-token', (event) => {
keytar.getPassword("LBRY", "auth_token").then(token => {
event.sender.send('auth-token-response', token ? token.toString().trim() : null)
});
});
ipcMain.on('set-auth-token', (event, token) => {
keytar.setPassword("LBRY", "auth_token", token ? token.toString().trim() : null);
});

View file

@ -11,8 +11,12 @@
"electron-dl": "^1.6.0",
"install": "^0.8.7",
"jayson": "^2.0.2",
"keytar": "^4.0.3",
"npm": "^4.2.0",
"semver": "^5.3.0",
"tree-kill": "^1.1.0"
},
"devDependencies": {
"electron-rebuild": "^1.5.11"
}
}

2016
app/yarn.lock Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,30 +1,34 @@
pip install -r build\requirements.txt
python build\set_version.py
# Get the latest stable version of Node.js or io.js
Install-Product node $env:nodejs_version
npm install -g yarn
yarn install
# install node modules
npm install
# do app
cd app
npm install
cd ..
# build ui
cd ui
npm install
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 ..
# build ui
cd 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
Copy-Item dist ..\app\ -recurse
cd ..
# get daemon and cli executable
$daemon_url = (Get-Content build\DAEMON_URL -Raw).replace("OSNAME", "windows")
Invoke-WebRequest -Uri $daemon_url -OutFile daemon.zip
@ -32,6 +36,7 @@ Expand-Archive daemon.zip -DestinationPath app\dist\
dir app\dist\ # verify that daemon binary is there
rm daemon.zip
# build electron app
node_modules\.bin\build -p never
$binary_name = Get-ChildItem -Path dist -Filter '*.exe' -Name
@ -39,9 +44,11 @@ $new_name = $binary_name -replace '^LBRY Setup (.*)\.exe$', 'LBRY_$1.exe'
Rename-Item -Path "dist\$binary_name" -NewName $new_name
dir dist # verify that binary was built/named correctly
# sign binary
nuget install secure-file -ExcludeVersion
secure-file\tools\secure-file -decrypt build\lbry2.pfx.enc -secret "$env:pfx_key"
& ${env:SIGNTOOL_PATH} sign /f build\lbry2.pfx /p "$env:key_pass" /tr http://tsa.starfieldtech.com /td SHA256 /fd SHA256 dist\*.exe
python build\upload_assets.py

View file

@ -45,19 +45,12 @@ if [ "$FULL_BUILD" == "true" ]; then
python "$BUILD_DIR/set_version.py"
fi
libsecret="libsecret-1-dev"
if $LINUX && [ -z "$(dpkg-query --show --showformat='${Status}\n' "$libsecret" 2>/dev/null | grep "install ok installed")" ]; then
# this is needed for keytar, which does secure password/token management
sudo apt-get install --no-install-recommends -y "$libsecret"
fi
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
mkdir -p "$ROOT/dist"
[ -d "$ROOT/app/dist" ] && rm -rf "$ROOT/app/dist"
mkdir -p "$ROOT/app/dist"
npm install
yarn install
@ -67,16 +60,8 @@ npm install
(
cd "$ROOT/ui"
npm 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/ui"
set -e
node_modules/.bin/electron-rebuild "$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
@ -105,7 +90,15 @@ rm "$BUILD_DIR/daemon.zip"
(
cd "$ROOT/app"
npm install
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/app"
set -e
node_modules/.bin/electron-rebuild "$ROOT/app"
)
if [ "$FULL_BUILD" == "true" ]; then

View file

@ -41,7 +41,7 @@ set -eu
if $LINUX; then
INSTALL="$SUDO apt-get install --no-install-recommends -y"
$INSTALL build-essential libssl-dev libffi-dev libgmp3-dev python2.7-dev
$INSTALL build-essential libssl-dev libffi-dev libgmp3-dev python2.7-dev libsecret-1-dev
elif $OSX && ! cmd_exists brew ; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
@ -88,6 +88,17 @@ if ! cmd_exists node; then
fi
fi
if ! cmd_exists yarn; then
if $LINUX; then
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | $SUDO apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | $SUDO tee /etc/apt/sources.list.d/yarn.list
$SUDO apt-get update
$SUDO apt-get install yarn
elif $OSX; then
brew install yarn
fi
fi
if ! cmd_exists unzip; then
if $LINUX; then
$INSTALL unzip

View file

@ -1,7 +1,5 @@
GitPython==2.1.1
PyGithub==1.32
requests[security]==2.13.0
PyInstaller==3.2.1
uritemplate==3.0.0
git+https://github.com/lbryio/bumpversion.git
boto3==1.4.4

View file

@ -56,6 +56,7 @@
}
},
"devDependencies": {
"devtron": "^1.4.0",
"electron": "^1.4.15",
"electron-builder": "^11.7.0",
"electron-debug": "^1.1.0"

View file

@ -1,5 +1,6 @@
## Development Setup
- Install node and npm (linux users: [use this](https://github.com/nodesource/distributions). if that doesn't work, [this gist may be useful](https://gist.github.com/isaacs/579814))
- Run `./watch.sh` (this will `npm install` dependencies)
- `npm install -g yarn` (or see https://yarnpkg.com/en/docs/install)
- Run `./watch.sh` (this will `yarn install` dependencies)

View file

@ -1,7 +1,7 @@
import lbry from "./lbry.js";
const querystring = require("querystring");
const keytar = require("keytar");
const { ipcRenderer } = require("electron");
const lbryio = {
enabled: true,
@ -114,17 +114,16 @@ lbryio.call = function(resource, action, params = {}, method = "get") {
};
lbryio.getAuthToken = () => {
return keytar.getPassword("LBRY", "auth_token").then(token => {
return token ? token.toString().trim() : null;
return new Promise((resolve, reject) => {
ipcRenderer.once("auth-token-response", (event, token) => {
return resolve(token);
});
ipcRenderer.send("get-auth-token");
});
};
lbryio.setAuthToken = token => {
return keytar.setPassword(
"LBRY",
"auth_token",
token ? token.toString().trim() : null
);
ipcRenderer.send("set-auth-token", token);
};
lbryio.getCurrentUser = () => {

View file

@ -28,7 +28,6 @@
"from2": "^2.3.0",
"jshashes": "^1.0.6",
"localforage": "^1.5.0",
"keytar": "^4.0.3",
"node-sass": "^3.8.0",
"rc-progress": "^2.0.6",
"react": "^15.4.0",
@ -55,7 +54,6 @@
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.18.0",
"electron-rebuild": "^1.5.11",
"eslint": "^3.10.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-loader": "^1.6.1",

View file

@ -14,7 +14,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -d "$DIR/node_modules" ]; then
echo "Installing NPM modules"
npm install
yarn install
fi
# run sass once without --watch to force update. then run with --watch to keep watching

5285
ui/yarn.lock Normal file

File diff suppressed because it is too large Load diff

1586
yarn.lock Normal file

File diff suppressed because it is too large Load diff