Commit Graph

56 Commits

Author SHA1 Message Date
Adam Weeden dacfcd2cb8 Add some type hinting post-package update for Axios 2023-03-24 16:47:54 -04:00
Adam Weeden 69625f1a01
Fix broken tests (#1523) 2023-03-24 14:16:49 -04:00
Adam Weeden 347c06d250
Remove arch ia32 as it's no longer supported in Electron 19 (fix #1439, PR #1441) 2022-07-30 13:19:45 -04:00
Adam Weeden 3a8f66a7b6
macOS: universal architecture app support (fix #1384, PR #1386)
As noted in `API.md`:

- When specifying `universal` you must be building for the `darwin`, `mas`, `mac`, or `osx` platforms. This will generate a universal (M1 and x86) app.
2022-04-18 19:11:31 -04:00
Adam Weeden f6852d5208
Update browser versions + add fix for Firefox user agent (#1388) 2022-04-18 18:42:25 -04:00
Adam Weeden b9c5e2b464
Fix upgrade not working (#1286)
* Attempt to get upgrade working right; in progress

* Got it fixed in Mac

* Fix some linting errors

* Finish fixing upgrade + tests

* Integration testing for global shortcuts

* Regenerate shrinkwrap

* Get rid of deprecated rmdirSync

* Remove instead of rm for 12.x support

* Make dereferencing platform dependent

* Fix folder copy funkiness

* Whoops

* Whoops 2: Extra Whoops

* Update Electron to 13.5.1; Fix auth manual tests

* Rework relock

* Add a request for help.

* Update @types/node to 14
2021-11-29 12:01:20 -05:00
Adam Weeden b74c0bf959
Make app strict TypeScript + linting (and add a shared project) (#1231)
* Convert app to strict typing + shared library

* Fix new code post-merge

* Remove extraneous lint ignores

* Apply suggestions from code review

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>

* Fix prettier complaint

* Dedupe eslint files

* Fix some refs after merge

* Fix clean:full command

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-06-26 09:59:28 -04:00
Adam Weeden 7a08a2d676
Enable TypeScript strict:true, and more typescript-eslint rules (#1223)
* Catch promise errors better

* Move subFunctions to bottom of createNewWindow

* Use parents when creating child BrowserWindow instances

* Some about:blank pages have an anchor (for some reason)

* Inject browserWindowOptions better

* Interim refactor to MainWindow object

* Split up the window functions/helpers/events some

* Further separate out window functions + tests

* Add a mock for unit testing functions that access electron

* Add unit tests for onWillPreventUnload

* Improve windowEvents tests

* Add the first test for windowHelpers

* Move WebRequest event handling to node

* insertCSS completely under test

* clearAppData completely under test

* Fix contextMenu require bug

* More tests + fixes

* Fix + add to createNewTab tests

* Convert createMainWindow back to func + work out gremlins

* Move setupWindow away from main since its shared

* Make sure contextMenu is handling promises

* Fix issues with fullscreen not working + menu refactor

* Run jest against app/dist so that we can hit app unit tests as well

* Requested PR changes

* Add strict typing; tests currently failing

* Fix failing unit tests

* Add some more eslint warnings and fixes

* More eslint fixes

* Strict typing on (still issues with the lib dir)

* Fix the package.json import/require

* Fix some funky test errors

* Warn -> Error for eslint rules

* @ts-ignore -> @ts-expect-error

* Add back the ext code I removed
2021-06-15 22:20:49 -04:00
Ronan Jouchet ea24a0fdeb Fix gitcloud 0.2.3 import 2021-06-14 14:39:43 -04:00
Adam Weeden d6730f7022
Improve user agent handling/provide user agent "short" codes (#1198) 2021-05-21 23:41:13 -04:00
Adam Weeden 8f9135312b
Docker: fix Windows builds (fix #997), line endings, switch to Alpine (PR #1122)
- Docker builds for Windows are fixed (fixes #997)
- Switched over to use Alpine (as was indicated as desired in https://github.com/nativefier/nativefier/issues/375#issuecomment-304247033) - which may mean #375 is fixed as well.
- Fixed bug where Docker has the wrong line endings when copying from a Windows host
- Fixed the invalid `arm` arch to `armv7l`
- Add `npm t` to the docker build to ensure tests pass before we start trying to do builds
- Add a message to help the user when trying to build Mac apps on Windows as a non-Admin (currently an unhelpful exception)

Co-authored-by: Ronan Jouchet <ronan@jouchet.fr>
2021-03-02 00:16:30 -05:00
Jia Hao 6316d23762 Move to nativefier organization 2021-01-30 04:49:52 +00:00
Jia Hao 66ff02584e Temporarily increase timeout for network call in test 2021-01-30 04:49:36 +00:00
Ronan Jouchet b0a953eb2d Get rid of cheerio
Not sure this one will stick, maybe my regex is too naive.
Works for common websites. Let's see
2021-01-15 22:15:48 -05:00
Ronan Jouchet 17f688de63 Get rid of lodash 2021-01-15 21:50:07 -05:00
Cassidy James Blaede 1c06af23fa
inferOs: Add support for arm64 (#1037)
Tested on a Pinebook Pro running elementary OS
2020-08-29 16:12:22 -04:00
Ronan Jouchet 8684887fc6 Bump eslint to 7.x, fix new lint errors 2020-07-18 11:19:58 -04:00
Ronan Jouchet 0c2510f31e Bump default Electron to 8.2.0 and Prettier 2020-03-24 20:27:25 -04:00
Ronan Jouchet d6e7aa6f41 Fix inferTitle test broken on Node 8 2020-03-15 17:19:19 -04:00
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
Ronan Jouchet 19561e9ad6 Make eslint happy 2018-07-21 09:16:02 -04:00
Ronan Jouchet bbef14ccc6 Bump default Electron to 2.0.5, upgrade deps 2018-07-21 08:58:53 -04:00
Goh Jia Hao 0b47999c3e Fix lint error 2018-06-10 11:07:06 -07:00
Goh Jia Hao bd89f90a3d Remove workaround for slashes in page title
This was reported in #22 and has been fixed upstream in electron-userland/electron-packager#308
2018-06-10 11:00:22 -07:00
Goh Jia Hao 49272d1a89 Add test for inferTitle 2018-06-10 11:00:16 -07:00
David Kramer fe6fd9d2a1 Fix `prettier` lint error (#625) 2018-05-27 17:18:33 -04:00
Goh Jia Hao 16aae0a937 Refactor tests to use async/await 2018-05-24 22:46:49 -07:00
Goh Jia Hao 95fc46d38d Integrate prettier 2018-05-24 00:02:44 -07:00
Goh Jia Hao 949dcfadd8 Migrate Mocha tests to Jest 2018-05-23 23:44:03 -07:00
Goh Jia Hao bb67448328 Fix infer icon url #529 2018-03-29 19:38:04 -07:00
David Ollerhead e1909bf5c8 Support Mac App Store (--mas) builds (PR #532) 2018-02-02 08:06:29 -05:00
Ronan Jouchet 6fb3b92eb8
Upgrade dependencies and default to latest Electron 1.7.9 (PR #483)
* Update deps except eslint
* Update eslint and lint:fix (WIP, needs manual fixing for remaining 44 problems)
* Manually fix remaining eslint errors
* Document deprecation of `version-string` as of electron-packager 9.0.0
* Upgrade to Electron 1.7.9 (chrome-58, node-7.9.0, v8-5.8)
* npm: Disable generation of package-lock.json and gitignore it
  --Trying this, package-lock is a pain in PRs. May not be a good idea
  (obviously we lose deps pinning), will revert if necessary.--
* npm tasks: add dev-up-win for Windows developers,
  and e2e for end-to-end tests. Update docs.
* Move normalizeUrl test to a jest unit test, makes no sense to be in the mocha e2e tests
* Switch from babel-preset-es2015 to babel-preset-env,
  with target.node=4.0. Seem like it's today's most convenient
  way to support the latest ES and let babel transpile to what
  makes sense for our currently minimal node version
2017-11-14 08:05:01 -05:00
Jia Hao Goh 1505933826 Promisfy and parallelise config, add unit tests
Instead of optionsMain exporting an async function, this commit changes
it to return a promise instead. We split all the needed async
helpers for this config builder into smaller promises, in `src/options/*`. Another side
effect of this is that we perform all our async config inferring in
parallel, which speeds up the nativefier CLI.

Add proper unit tests as well for all of these promises. Switch to
Jest for these unit tests, and we are temporarily running both Jest and
mocha together in `npm test`. To refactor all the Mocha code to use Jest in
a future commit.
2017-05-07 15:49:15 +08:00
Matt Harris 10eaa53b26 Add ARM build support (#360) 2017-05-06 15:11:51 -04: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
Jia Hao Goh b467ac7a51 Promisify inferTitle module
Also remove the request dependency, use Axios instead
2017-04-21 00:24:48 +08:00
Ronan Jouchet be4b9a7436 Fix #327 - Update dependencies (except eslint), default to Electron 1.6.6 (#341) 2017-04-18 17:30:54 -04:00
Goh Jia Hao 1865e97e1a Remove accidentally introduced spacing 2016-05-27 00:15:48 +08:00
Goh Jia Hao 0c588b7219 Allow gitcloud matching of icons for multiple words 2016-05-27 00:10:23 +08:00
Goh Jia Hao 960f3362c9 Update eslint to v2.0.0 2016-05-26 23:05:44 +08:00
Goh Jia Hao 5833347ad8 Fix parsing of title including more than the title tag
- Fixes #195
2016-05-26 18:16:02 +08:00
Jia Hao e7390b9e33 Implement setting of verbose log level 2016-03-25 20:50:52 +08:00
Jia Hao 94c9fdb424 Contain fallback user agent within inferUserAgent 2016-03-25 20:10:45 +08:00
Jia Hao 9a9a63c15a Use axios instead of request 2016-03-25 19:58:03 +08:00
Jia Hao d890078e6e Should throw error on invalid platform 2016-03-25 19:29:13 +08:00
sa 4b6716efef Infer user agent from Electron's online version list 2016-03-19 21:14:41 -04:00
Jia Hao a8072d2234 Hopefully fix icon retrieval bugs
Icon ext from page-icon contains `.` before ext now, e.g. `.png`
2016-03-14 12:28:14 +08:00
Jia Hao e1f2e662e9 Add check for correct icon format 2016-03-12 15:17:03 +08:00
Jia Hao 4c708fac26 Try to use assets store for icons before infer
Also promisified inferIcon
2016-03-11 12:40:08 +08:00
Jia Hao d04cf0ad3a Properly fail if icon is not found by pageicon 2016-03-10 15:52:02 +08:00