The standard approach on Darwin is to keen applications running when the
window is closed. Clicking the apps icon again in the doc should bring
back the application window.
This changeset refactors things to handle this. It will keep Zap and lnd
running in the background when the main application window is closed.
Quitting the app will stop both the app and lnd.
Fix#586Fix#601
Add a script that fetches specific lnd binaries for each supported
platform/arch into the resources directory and update package scripts
to build for multiple architectures.
Use `lnd-binary` to download and install the correct mac/windows/linux
lnd binary as part of the install process.
See https://github.com/mrfelton/lnd-binary
Windows build is failing on this line with:
> node --trace-warnings -r babel-register ./node_modules/.bin/webpack-serve --config webpack.config.renderer.dev.js
C:\Users\user\Documents\zap-desktop\node_modules\.bin\webpack-serve:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Module._extensions..js (module.js:663:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\user\Documents\zap-desktop\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
This is because webpack-serve expects a js file, but on windows, which
lacks supports for shebang comments, they are wrapped in .cmd files to
be executable. e.g. see:
https://github.com/gotwarlost/istanbul#usage-on-windows
To fix this, we reference the js file directly to avoid the .cmd
wrapping.
Fetch the current block height from multiple block explorers early on in
the sync process. This ensures that we get the correct block height in
the case where our BTCd node is still mid way through syncing. Do this
in the main process rather than in the render process.
Define an npm config variable in package.json to specify where the
stylesheets are that we want to lint and update our package scripts to
reference this.
It looks like we were a little hasty in #492 as rimraf is used directly
within package.json in the `flow-typed` script and so it needs to remain
as a dev dependency.
See https://github.com/LN-Zap/zap-desktop/pull/492
Concurrently v3.6.0 includes a number of improvements and fixes. Of
particular interest is the new npm command shortcut feature which we can
use to shorten our package scripts a little more.
See https://github.com/kimmobrunfeldt/concurrently/releases/tag/3.6.0
Remove the following project dependencies, which are not being used:
- express
- rimraf
- sinon
- bitcore-lib
- d3-force
- d3-selection
- d3-zoom
- split2
- xtend
Use `CspHtmlWebpackPlugin` to generate our content security policy
using code rather than hard coding meta tags on our html index page.
This provides us a more flexible means to configure our CSP dynamically.
Use `HtmlWebpackPlugin` to generate our final html file so that we can
remove our inline scripts and insert them dynamically based on our
webpack config.
This enables easy access to all lnd settings for development, and is a step
toward relying on an external configuration file that will be accessible to
users for whom the code is not.
Webpack v4 introduced a new `mode` setting, which - amongst other
things - automates the definition of the NODE_ENV environment variable.
We already had the `mode` settings set in our webpack configs so this
change is just to clean up some redundant code that is handled
automatically by this setting.
See:
- https://webpack.js.org/concepts/mode/
pass the `--raw` flag to concurrently so that we output the raw output
of processes. This disables concurrently prettifying and provides a more
legible output for our scripts.
Automatically validate commit messages according to the Conventional
Commit standard in a git commit-msg hook.
This functionality is optional and can be enabled by adding a .opt-in
file with a line `commit-msg`.
See:
- http://conventionalcommits.org/
- https://github.com/marionebl/commitlint
Currently we use eslint and prettier to lint and format code. However,
running the linter is a manual step that is easy to forget.
To improve this we run our lint scripts in a git pre-commit hook. This
functionality is optional and can be enabled by adding a .opt-in file
with a line `pre-commit`.
Currently we use eslint to lint code, but formatting the code according
to our ruleset is a manual process.
Implement `prettier` so that code is automatically formatted as part of
our development workflow.
See https://prettier.io/
Use debug-logger to provide a more comprehensive and flexible logging
solution. Use two separate log handlers to provide separation between
electron and and lnd logs.
There is an unneeded call to `concurrently` in the `npm run dev` script.
This causes things that should be output in colour (eg debug messages
when running with DEBUG=*) to not be output in colour which makes
debugging things harder than it should be.
This was in place because previously lnd was being started up externally
in the `npm run dev` script at the same time as starting up the app. But
we now use spawn from within the app to start up lnd.
The call to `concurrently` is no longer needed.
See d8c5623e01