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>
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>