Revamp and move to TypeScript #898
Conversation
cba9ab2
to
7af25c1
Compare
My own use cases are very basic though, only covering a small subset of CLI flags, and only on Linux. So, I'm asking the community for help to manually test other workflows / platforms / flags and report bugs. I will fix them and will do my best to add unit & integration tests. @jiahaog, overall feedback welcome. I tried to make this revamp as uncontroversial as possible: keeping the CLI unchanged, not adding any new feature, using proven tech, getting rid of the obsolete, and striving to make things simpler. If there's any major disagreement with what I'm doing here, please shout as soon as possible 🙂. @remusao @saulocastelo @Aidoboy @mxdpeep @dlight @core-code @akkhilaysh @vinifmor @dipenpatel235 @3ndlos @freeze455 @voltechs @partynikko @jmalarcon @dukejones @bacongravy @codekandis (and passersby), hi! I'm pinging you because you recently showed interest in Nativefier by participating in issues discussions. I need your help to test this work-in-progress branch.
ETA is I-don't-know, but the items I want to address before a release are listed at README / TS: Minimum to release beta. Thanks for your help!!! Let's do this! |
3685964
to
a09ff34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronjouch This is big... and awesome! I don't know if this is ready for review, but I just did a first pass through the changes and only have some minor comments — I think you have already covered most of the TODO items in the readme.
I'll try to find some time this weekend to test the changes on a mac, but everything looks good!
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@jiahaog @remusao I have a workaround for the app
As I was, reluctantly, going back to webpack today, I thought: when Turns out, we can! Plugging in
I just pushed 34ecd0c . Please try it and offer your feedback. |
I am not very familiar with the workflow of nativefier so maybe this is dumb but, would it make sense to not install the dependencies of
In terms of flow, it seems that calling |
@remusao true, it's a third option, thanks. It's not dumb.
So, for now, still preferring the yarn workaround to that. |
@ronjouch Good point about the overhead, I just checked locally to see how much time it takes for the
Interestingly, the same workflow with Yarn seems much faster, especially subsequent calls to |
Yes all flags worked, in the meantime extended it to user browseroptions too. There is just on issue related to windows, I first wrote a batch file (*.bat), so I can repack it at anytime. But for some reason the passed json string does not work. Then I tried directly in a cmd, and that worked.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
How would one test this with a project that depends on Nativefier via NPM? I use it with https://github.com/Aidoboy/nativefier-install |
This comment has been minimized.
This comment has been minimized.
@ronjouch Ok, cool! I'll try to poke it a bit soon. I've been pretty busy recently. |
@Aidoboy the last commit called It's untested, so probablymaybecertainly broken right now, but not irremediably, and fixable with your feedback. Please give it a shot and shout back! Also, all general feedback regarding this revamp very welcome; file issues with a
|
Boy am I glad my spidey senses kicked in when I started working on this myself last night! Are you still working on this @ronjouch? Seems like just small fixes from here on out, let me know if you need a hand. Nice work by the way! 🎆 |
@tristangodfrey thanks! Yes, this is still my current code project these days, progressing when I have time on evenings and weekends. ETA is probably a few weeks, or months if I'm lazy. The remaining tasks before a release are listed at README / TS: Minimum to release beta. If you want to give a hand, feel free to grab one of these and submit a PR! |
I've been a bit of a recluse here. I came up for some air and gave this a try. Things seem to be working pretty well. I still can't seem to get Examples of apps I build/use with
Thanks for all the hustle and hard work, everyone! |
@voltechs thanks for the feedback.
👍, good to know. Which OS are you running, by the way?
Thanks for the report, but I cannot reproduce the issue. EDIT oh, I see an example in your previous message:
|
…lds more reliable
…cally-test features work before publishing new releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so so much for taking the time to do this!! I ran some basic workflows on a mac and it works great as well. Please let me know if you need any help merging / publishing this! Also, will you be squashing the commits when you do the merge?
.travis.yml
Outdated
node_js: | ||
- '11' | ||
- '10' | ||
- '13' # Changing this? Remind to adjust the linter condition below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this comment mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this comment mean?
@jiahaog see a few lines below; with the addition of {Windows, macOS} platforms in Travis, CI duration lengthened, so I added a condition restricting the linter to run only on a single sub-build, to shave off 10s * 8 from the build:
# Only run linter once, for faster CI
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_NODE_VERSION" = "13" ]; then npm run lint; fi
I just pushed a little improvement of the comment to clearer # Changing this? Remind to adjust the linter condition below causing linter to run for only one version (for faster CI)
Thank you so so much for taking the time to do this!! I ran some basic workflows on a mac and it works great as well.
@jiahaog welcome 🙂, and thanks for the final tests. I use lots of open-source software at home and at work, this is for me an occasion to give back in a context that I know (I do TS at work these days), and contribute a lot by cleaning & strengthening a codebase that needed it. The last few weeks I got confident that at least common use cases will be fine, as:
- I got a fair amount of feedback in the last weeks, both in this PR and also in a few existing issues where I suggested reporters to give this branch a try because it fixes their issues. Feedback is largely positive, and a few minor remaining bugs were reported and fixed.
- The added tests, added CI runs for all platforms, scripting of a pre-publish manual test, and final exploratory testing on Linux & Windows, are all reassuring.
There will inevitably be regressions given the amount of changes, but I'm not anticipating a tornado of bug reports. I'm subscribed to issues notifications and will keep a close eye on them after releasing, fixing regressions quickly in patch versions.
Please let me know if you need any help merging / publishing this! Also, will you be squashing the commits when you do the merge?
@jiahaog I'll be merging this as 8.0.0 today or next week, with the description of this PR as release notes. I will squash (a few squashes already happened, for rebase simplicity). I don't anticipate needing help merging & publishing (the normal release process should work), but will ping you if something I forgot about goes wrong.
Thanks for the support and reviews, cheers!
Actually not sure this will work, but let's try. If that works, that means we're back to pre- #898 (comment) , with a 60s timeout due to npm bug npm/cli#757 Looking at a real fix, potentially coming back to `webpack` the app.
As documented in #923 (comment) , - #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 #898 (comment) - 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.
It looks like the repository isn't public. I keep getting this error:
|
## 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: nativefier#907 (comment) ## 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 nativefier#379: fix zoom with `Ctrl` + numpad `+`/`-` - Fix pinch-to-zoom (see nativefier#379 (comment) )
Actually not sure this will work, but let's try. If that works, that means we're back to pre- nativefier#898 (comment) , with a 60s timeout due to npm bug npm/cli#757 Looking at a real fix, potentially coming back to `webpack` the app.
…ivefier#923) As documented in nativefier#923 (comment) , - nativefier#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 nativefier#898 (comment) - 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.
Breaking changes
as little as possible. Please report regressions.
[8.0 regression] Unable to download Electron if behind a proxy #907 (comment)
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:
is twice LTS, and easily available even in conservative Linux distros.
No reason not to demand it.
and fight interface bugs at runtime rather than at compile time.
With that, get rid of everything Babel/Webpack.
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.
fine & clear trace of the program flow. This will be helpful to
debug user-reported issues, and already helped me fix a few bugs.
progress bar based on package
progress
. Nice logging (minimalby default, the verbose logging mentioned above is only used
when passing
--verbose
) is better and one less dependency.async
package, a relic from old callback-hell early Node.Also dump a few other micro-packages unnecessary now.
fixes, simplifications, jsdoc type annotations to types, etc.
exotic than good'ol'linters, and whose signal-to-noise ratio is too low.
Also, add a manual test script, helping to quickly verify the
hard-to-programatically-test stuff before releases, and limit regressions.
not to fix bugs, but to get Nativefier in better shape to do so.
Bugfixes will come later. Still, these got addressed:
Alt
+Left
/Right
for previous/next navigation.Ctrl
+ numpad+
/-
Todos left for later
@ts-ignore
s