1
0
mirror of https://github.com/jiahaog/Nativefier synced 2024-06-22 07:16:34 +02:00
Commit Graph

20 Commits

Author SHA1 Message Date
Ronan Jouchet
c9ee6667d4
Revamp and move to TypeScript (#898)
## Breaking changes

- Require **Node >= 8.10.0 and npm 5.6.0**
- Move to **Electron 8.1.1**.
- That's it. Lots of care went into breaking CLI & programmatic behavior
  as little as possible. **Please report regressions**.
- Known issue: build may fail behind a proxy. Get in touch if you use one:
  https://github.com/jiahaog/nativefier/issues/907#issuecomment-596144768

## Changes summary

Nativefier didn't get much love recently, to the point that it's
becoming hard to run on recent Node, due to old dependencies.
Also, some past practices now seem weird, as better expressible
by modern JS/TS, discouraging contributions including mine.

Addressing this, and one thing leading to another, came a
bigger-than-expected revamp, aiming at making Nativefier more
**lean, stable, future-proof, user-friendly and dev-friendly**,
while **not changing the CLI/programmatic interfaces**. Highlights:

- **Require Node>=8**, as imposed by many of our dependencies. Node 8
  is twice LTS, and easily available even in conservative Linux distros.
  No reason not to demand it.
- **Default to Electron 8**.
- **Bump** all dependencies to latest version, including electron-packager.
- **Move to TS**. TS is great. As of today, I see no reason not to use it,
  and fight interface bugs at runtime rather than at compile time.
  With that, get rid of everything Babel/Webpack.
- **Move away from Gulp**. Gulp's selling point is perf via streaming,
  but for small builds like Nativefier, npm tasks are plenty good
  and less dependency bloat. Gulp was the driver for this PR: broken
  on Node 12, and I didn't feel like just upgrading and keeping it.
- Add tons of **verbose logs** everywhere it makes sense, to have a
  fine & clear trace of the program flow. This will be helpful to
  debug user-reported issues, and already helped me fix a few bugs.
    - With better simple logging, get rid of the quirky and buggy
      progress bar based on package `progress`. Nice logging (minimal
      by default, the verbose logging mentioned above is only used
      when passing `--verbose`) is better and one less dependency.
- **Dump `async` package**, a relic from old callback-hell early Node.
  Also dump a few other micro-packages unnecessary now.
- A first pass of code **cleanup** thanks to modern JS/TS features:
  fixes, simplifications, jsdoc type annotations to types, etc.
- **Remove GitHub integrations Hound & CodeClimate**, which are more
  exotic than good'ol'linters, and whose signal-to-noise ratio is too low.
- Quality: **Add tests** and add **Windows + macOS CI builds**.
  Also, add a **manual test script**, helping to quickly verify the
  hard-to-programatically-test stuff before releases, and limit regressions.
- **Fix a very small number of existing bugs**. The goal of this PR was
  *not* to fix bugs, but to get Nativefier in better shape to do so.
  Bugfixes will come later. Still, these got addressed:
  - Add common `Alt`+`Left`/`Right` for previous/next navigation.
  - Improve #379: fix zoom with `Ctrl` + numpad `+`/`-`
  - Fix pinch-to-zoom (see https://github.com/jiahaog/nativefier/issues/379#issuecomment-598612128 )
2020-03-15 16:50:01 -04:00
Dominic Hopton
e064f765cb Fix CSS & JavaScript injection (Fixes #703, Fixes #731, PR #732)
* Fix for CSS Injection not working (#703)

Issue:
When using `onHeadersReceived`, the code was passing `null` for the filters.
This appears to trigger behaviour that matches _no_ urls at all.
This results in it never being called to inject the CSS.

Fix:
Pass an empty array instead. Now it's called for all URLs.

Tests pass & linting is clean

* Fix JavaScript injection (#731)

Issue:
It appears that on low endd evices (Core m3 MacBook), the attachment to
`DOMContentLoaded` happens _after_ the event has been raised, so does
not have a chance to inject the script.

Fix:
Move the attachment to the top of the file -- before the imports. This
triggers a bunch of linting erros, so also added disablement inplace.

Additional:
Clarified when the injected JS gets loaded, and what it can assume about
the DOM.
2019-01-01 23:38:45 -05:00
Sascha Ißbrücker
27ea3fc4a3 Show application window on notification click (#640) 2018-08-22 16:06:44 -04:00
David Kramer
ec1023d7ef Fix #95, #384 - Use electron-context-menu, supporting cut/copy/paste (PR #588)
The electron-context-menu package uses the context-menu event emitted by WebContents (API added in Electron 1.0.2) to add a general context menu supporting generic actions (e.g. cut/copy/paste) that can be customized. This change replaces the existing context menu, which relies on adding an event listener in preload.js, with one built using the new package.
2018-04-22 19:48:56 -04:00
David Kramer
454ab1e7bd Fix #474: Remember custom zoom level (PR #582)
... by using setZoomFactor instead of sending change-zoom event.
2018-04-22 15:54:29 -04:00
Matt Harris
eb08d85830 Fix #480 - Move all console.* to loglevel.* calls, eslint-fail on console.* (PR #507) 2017-12-19 08:42:06 -05:00
Jia Hao Goh
8f78dd03af Update eslint and use Airbnb style
- Add `npm run lint:fix` command
- Cleanup inferIcon.js logic slightly
2017-04-29 22:52:12 +08:00
Goh Jia Hao
1286372f95 Add editorconfig to trim trailing whitespace 2016-10-09 19:05:43 +08:00
Goh Jia Hao
2529153ca1 Use let instead of const 2016-10-09 14:16:44 +08:00
Ronan Jouchet
a42554fe1d Fix context menu actions broken on <a> elements containing nested markup
Test case: open nativefier on

```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Test</title>
</head>
<body>
  <a href="https://google.com/">Google</a>
  <br>
  <a href="https://google.com/"><span>Google, in span</span></a>
</body>
</html>
```

* **Expected**: both links open in default browser
* **Actual under nativefier 7.0.1**: Nothing happens when clicking the second link in which the `<a>` contains a `<span>`
2016-09-29 14:10:28 -04:00
Jia Hao
612da8ce36 Fix/performance issues with FOUC (#214)
Fix/performance issues with FOUC #191
2016-06-16 15:28:36 +08:00
Goh Jia Hao
286e5bf7d6 Use destructuring for ES6 import 2016-05-26 16:51:07 +08:00
Jia Hao
8ef3137d02 Change eslint to disallow unused variables 2016-02-28 00:49:54 +08:00
Jia Hao
4d49c01ff3 Implement injection of .js 2016-02-25 14:11:48 +08:00
Jia Hao
b2e05c925b Use ES6 syntax for placeholder app 2016-01-29 22:04:41 +08:00
Jia Hao
d8fb87ccb5 Implement support for clicking buttons so that users can control where links open as referenced in #73 2016-01-25 16:49:11 +08:00
Jia Hao
949fce5e3c Implement right click context menu for regular href links 2016-01-25 15:56:33 +08:00
Jia Hao
82c29de231 Lint all files 2016-01-24 02:02:23 +08:00
Jia Hao
264037a867 Merge branch 'refactor/splitcomponents'
- Merge in gulp dev envirnoment
- Zoom functionality
- Split app into multiple components
2016-01-23 13:43:33 +08:00
Jia Hao
90ee346914 Refactor main.js into separate files, and put static files such as preload and login.html into app/src/static 2016-01-23 10:09:47 +08:00