2 Commits

Author SHA1 Message Date
Juan Cruz Viotti
b357047e3a
chore: encode complete paths to patched file in patches/ (#1987)
So that the build system doesn't need to know in advance at which
directory the paths needs to be applied.

This will make it easier to add patches support to the Concourse
pipelines.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2018-01-23 18:48:35 -04:00
Juan Cruz Viotti
9c055fb165 fix(CLI): workaround absolute paths in Browserify bundles (#1409)
For some strange reason, Browserify will hardcode absolute paths from
the machine that generated the bundle to be able to resolve `__dirname`
and `__filename` calls. This makes no sense, given that it means that
the Browserify bundle will not work when we move it to another machine,
which went undetected probably for months.

The Browserify community apparently makes modules to fix this particular
issue (like `bundle-collapser`, and `intreq`), however none of this seem
to solve the problem for the Etcher CLI bundle.

I also gave https://github.com/zeit/pkg a go, however I gave up after
not being able to make use of native modules (nothing seems to work; the
packager result will simply not find the addons).

Finally, I ended up making the following workarounds:

- Edit the Browserify bundle file to use its own `__dirname` to
  dynamically resolve the values of `__dirname` and `__filename` of the
  files it contains

- Patch `lzma-native` to statically require its add-on rather than
  relying on dynamic requires from `node-pre-gyp`, which makes it
  impossible to resolve on the final bundle

See: https://github.com/resin-io/etcher/issues/355
See: http://stackoverflow.com/questions/21993073/browserify-with-paths-to-folders-in-my-system
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-05-11 15:37:45 -04:00