Thinking about it again, the user-friendlier `a.x` syntax has one disadvantage
over `^a.b.c`: it doesn't force deps upgrades when they upgrade Nativefier.
`a.x` is fine on initial install, but a user with an insecure dep
(e.g. axios 0.19.0) will _not_ get fixed axios 0.21.1 on upgrading Nativefier.
-> Come back to `a.x` everywhere.
Still not introducing package locks, they're too confusing to new devs.
See https://github.com/nativefier/nativefier/pull/1099#issuecomment-761250232
## 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 )
[Squirrel](https://github.com/Squirrel/Squirrel.Windows) is *"an installation and update
framework for Windows desktop apps "*.
This PR adds `electron-squirrel-startup`, allowing to package nativefier applications
into squirrel-based setup installers. Squirrel require this entrypoint to perform
desktop and startup menu creations, without showing the UI on setup launches.
- References: https://github.com/mongodb-js/electron-squirrel-startup
- Resolves `electron-winstaller` and `electron-installer-windows` support of desktop / startup menu shortcuts for nativefier packaged applications.
- The `electron-squirrel-startup` entrypoint has no effect on both Linux and Darwin, only on Windows
- Supporting it directly inside `nativefier` avoids having to "hack" around the existing `main.js`
and including dependencies from `electron-squirrel-startup` in an intermediate package
to be included in a third layer for the final installer executable
- The following script based on both `nativefier` and `electron-winstaller` templates
represents a portable proof of concept for this merge request :
```js
var nativefier = require('nativefier').default;
var electronInstaller = require('electron-winstaller');
var options = {
name: 'Web WhatsApp',
targetUrl: 'http://web.whatsapp.com',
platform: 'windows',
arch: 'x64',
version: '0.36.4',
out: '.',
overwrite: false,
asar: false,
counter: false,
bounce: false,
width: 1280,
height: 800,
showMenuBar: false,
fastQuit: false,
userAgent: 'Mozilla ...',
ignoreCertificate: false,
ignoreGpuBlacklist: false,
enableEs3Apis: false,
insecure: false,
honest: false,
zoom: 1.0,
singleInstance: false,
fileDownloadOptions: {
saveAs: true
},
processEnvs: {
GOOGLE_API_KEY: '<your-google-api-key>'
}
};
nativefier(options, function(error, appPath) {
if (error) {
console.error(error);
return;
}
console.log('App has been nativefied to', appPath);
resultPromise = electronInstaller.createWindowsInstaller({
appDirectory: 'Web WhatsApp-win32-x64',
outputDirectory: './',
authors: 'Web WhatsApp',
exe: 'Web WhatsApp.exe'
});
resultPromise.then(() => console.log('It worked!'), e => console.log(`No dice: ${e.message}`));
});
```
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.
* 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
- Issue https://github.com/jiahaog/nativefier/issues/19#issuecomment-173364234
- When a link that requests a new window is clicked, the app will check if the link is an external link. If so, the default desktop browser (Chrome, Safari etc.) will be opened. Otherwise, a new Electron BrowserWindow will be opened, which supports the use case of logging in to OAuth websites such as feedly.com