mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-16 18:15:08 +00:00
cde5c1e13b
As documented in https://github.com/jiahaog/nativefier/issues/923#issuecomment-599300317 , - #923 is caused by installing placeholder app deps at nativefier *install* time, with yarn (8.0.2) or npm (8.0.3). This is new in Nativefier 8.x, for the motivations behind it, see https://github.com/jiahaog/nativefier/pull/898#issuecomment-583865045 - During testing, I did test global installs, but never to a system / non-user-writable path (my `$npm_config_prefix` is set to `"$HOME/.node_modules"`) - But without such a config and when installing globally to a non-user-writable/system path with `sudo npm i -g nativefier`, - Installation of nativefier core works... - ... but then `postinstall` tries to do its job of installing app deps, and fails in various OS-dependent ways, but all about access rights. I suspect that, although main nativefier install runs as `su` with access rights to system paths, `postinstall` scripts are run *out* of `su`. That would make sense for security reasons: out of hook scripts, npm knows exactly what will be touched in your filesystem: it's the static contents of the published tarball; a postinstall script with sudo rights could do nasty dynamic stuff. So, although I don't see any mention of that in [npm-scripts docs / hooks](https://docs.npmjs.com/misc/scripts#hook-scripts) and I haven't dug npm/cli's code, I can understand it. So, reverting back to `webpack`ing the placeholder app, as done pre-8.0.
72 lines
1.8 KiB
Markdown
72 lines
1.8 KiB
Markdown
# Development Guide
|
|
|
|
## Setup
|
|
|
|
First, clone the project
|
|
|
|
```bash
|
|
git clone https://github.com/jiahaog/nativefier.git
|
|
cd nativefier
|
|
```
|
|
|
|
Install dependencies for both the CLI and the Electron app:
|
|
|
|
```bash
|
|
# Under Linux and macOS:
|
|
npm run dev-up
|
|
|
|
# Under Windows:
|
|
npm run dev-up-win
|
|
```
|
|
|
|
Build nativefier:
|
|
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
Set up a symbolic link so that running `nativefier` calls your dev version with your changes:
|
|
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
nativefier --your-awesome-new-flag 'https://your-test-site.com'
|
|
```
|
|
|
|
Then run your nativefier app *through the command line too* (to see logs & errors):
|
|
```bash
|
|
# 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](https://prettier.io/), 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](https://prettier.io/docs/en/editors.html).
|
|
|
|
## 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`
|