2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-05 12:57:52 +00:00
nativefier/docs/development.md
Joe Skeen 3e5f1fabad
[dev] Add unified {build,test} watch mode, using "concurrently" (#1011)
I noticed that the development README suggested using multiple console 
windows/tabs for a good development experience. Using the package `concurrently`,
we can streamline that and require only one window with output for both watch processes:

![image](https://user-images.githubusercontent.com/12286274/88694827-477d9e80-d0be-11ea-898c-ee9a509db4bb.png)


Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2020-08-05 12:52:49 -04:00

1.9 KiB

Development Guide

Setup

First, clone the project

git clone https://github.com/jiahaog/nativefier.git
cd nativefier

Install dependencies for both the CLI and the Electron app:

# Under Linux and macOS:
npm run dev-up

# Under Windows:
npm run dev-up-win

Build nativefier:

npm run build

Set up a symbolic link so that running nativefier calls your dev version with your changes:

npm link
which nativefier
# -> Should return a path, e.g. /home/youruser/.node_modules/lib/node_modules/nativefier
# If not, be sure your `npm_config_prefix` env var is set and in your `PATH`

After doing so, you can run Nativefier with your test parameters:

nativefier --your-awesome-new-flag 'https://your-test-site.com'

Then run your nativefier app through the command line too (to see logs & errors):

# Under Linux
./your-test-site-linux-x64/your-test-site

# Under Windows
your-test-site-win32-x64/your-test-site.exe

# Under macOS
open -a YourTestSite.app

Linting & formatting

Nativefier uses Prettier, which will shout at you for not formatting code exactly like it expects. This guarantees a homogenous style, but is painful to do manually. Do yourself a favor and install a Prettier plugin for your editor.

Tests

  • To run all tests, npm t
  • To run only unit tests, npm run test:unit
  • To run only integration tests, npm run test:integration
  • Logging is suppressed by default in tests, to avoid polluting Jest output. To get debug logs, npm run test:withlog or set the LOGLEVEL env. var.
  • For a good live experience, open two terminal panes/tabs running code/tests watchers:
    1. Run a TSC watcher: npm run build:watch
    2. Run a Jest unit tests watcher: npm run test:watch
  • Alternatively, you can run both test processes in the same terminal by running: npm run watch