Commit Graph

15 Commits

Author SHA1 Message Date
Ronan Jouchet cde5c1e13b Fix failing to global-sudo-install due to postinstall script (fix #923)
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.
2020-03-16 21:06:03 -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 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 44efe76a47 Use manual compiling of mocha so that sourcemaps can be used 2016-01-27 10:24:02 +08:00
Jia Hao bd6fedc0ef Workaround for windows `mkdir -p`, fixes #57
- Add a placeholder to keep the `app/lib` directory
- Remove `mkdir -p` postinstall script
2016-01-22 23:27:12 +08:00
Jia Hao 5379740dda Initial commit for working module only with api change 2016-01-18 21:45:18 +08:00
Jia Hao 4495b26c92 Fixed enormous bug in not passing the app configuration properly 2015-07-05 16:43:32 +08:00
Jia Hao 104821b759 Initial commit 2015-07-05 14:08:13 +08:00
Jia Hao d33c1e5fa2 Modified gitignore 2015-07-05 14:02:36 +08:00
Kenneth G. Franqueiro a360f6c2ee Add more comprehensive tests
This implements the following cases:

* Basic runs for a specific version/platform/arch with default options
  (testing for existence of expected output files/folders)
* Runs for each target platform with `out` set
* Runs for each target platform with `asar` set
* Runs for each target platform with `prune` set
* Runs for each target platform with `ignore` set
  * This includes testing `ignore` including a path separator
  * This also includes testing that `ignore` entries are applied
    with the app folder trimmed
* Runs for each target platform with `overwrite` set / not set
* Runs with `all` set, with `arch` or `platform` each set to `all`,
  and with `platform` set to multiple platforms (comma-delimited or
  array)
* Tests specifically for the darwin target platform, to test
  `icon` and `sign`

The test logic is organized such that the version of Electron being
tested can be configured once centrally (in config.json), and the tests
will not run until after downloading any necessary electron versions
(to avoid timing out due to long downloads).

Resolves #77.
2015-06-28 16:57:59 -04:00
Kenneth G. Franqueiro a157f716a5 Implement multi-target options and refactor code
This adds support for --all, --platform=all, and --arch=all.

In order to accommodate outputting multiple directories for multiple
platforms and architectures, this also implements a new directory
structure under the output folder (distinguished by both platform and
arch).  This structure is applied even to OS X distributions, which
formerly were output directly to an .app folder.  This could be considered
a backwards-incompatible change.

One other backwards-incompatible change is the value that the packager
function passes to the callback, which is now always an array of paths,
rather than just a single path.

The behavior of the icon option has also been modified to use its
basename and apply .ico or .icns depending on platform, to make it
usable with --all and --platform=all.  This attempts to maximize
backwards compatibility, by allowing a full filename to be specified,
but replacing the filename's extension with what is appropriate for
each target platform.  Alternatively, the extension can now be omitted.

In the process of implementing this, it became evident that some things
were being done in 3 different places, and weren't always being done
consistently, so I've deduplicated everything I could.

This also includes a few other changes to improve stability for
multi-target runs, and other fixes:

* Avoid targeting darwin if the environment doesn't support symlinks,
  to avoid the process bailing out on Windows
* Implement --overwrite centrally in index.js such that it explicitly
  skips if an output directory already exists, for consistency with
  all target platforms and to avoid any possible errors that would halt
  operation during one target of a multi-target run
* Use ncp instead of mv to move to finalPath, which avoids flakiness
  I noticed when testing on Windows 8 especially with multi-target runs
* Simplify temp directory logic by using a nested structure, so there
  is only one top-level directory to clean up
* Reinstate fix from #55 which seems to have been clobbered by a later
  merge
* linux.createApp now resolves to the final output directory;
  it was formerly resolving to the executable path
* mac.createApp now replaces space with underscore in bundle IDs
* Only the platform modules that are needed are loaded
* The win32 module only loads rcedit if needed

This also fixes a couple of missing updates to docs (readme/usage).

This commit addresses the following issues:

* Resolves #40
* Resolves #38
* Resolves #70
* Works around #71
* Resolves #84 by reinstating #55
2015-06-28 16:57:56 -04:00
Max Ogden 86edff69d8 add basic tests, remove unused folder, make linux out dir behave like other OSes 2015-06-27 19:48:35 -05:00
Max Ogden 4c08efb6a1 gitignore 2015-03-22 19:55:57 -07:00
Max Ogden 6244861b74 update name 2015-03-22 19:55:15 -07:00
Max Ogden cf7fe77eb6 first working version 2015-03-22 19:51:19 -07:00