Closed d0whc3r closed 5 years ago
Thanks for the PR, but this should be solved in https://github.com/kevva/bin-wrapper, not in every binary module individually.
Hi this is also something that I would like to see added, what would your suggestion be to solve this? An environment variable that overrides the src input that is provided to bin-wrapper?
what would your suggestion be to solve this?
I have the same question, seeing as bin-wrapper
doesn't seem to [currently] be designed such that this sort of feature would be possible without also updating downstream projects.
The pattern used by imagemin/mozjpeg-bin#42 and sass/node-sass suggests maybe that bin-wrapper
could be updated to allow for something like (modified from the example supplied at kevva/bin-wrapper):
const base = 'https://github.com/imagemin/gifsicle-bin/raw/master/vendor';
const bin = new BinWrapper()
.defaultBaseUrl(base)
.baseOverrideEnvName("GIFSICLE_BINARY_SITE")
.baseOverrideConfigName("gifsicle_binary_site")
.src(`macos/gifsicle`, 'darwin')
.src(`linux/x64/gifsicle`, 'linux', 'x64')
.src(`win/x64/gifsicle.exe`, 'win32', 'x64')
.dest(path.join('vendor'))
.use(process.platform === 'win32' ? 'gifsicle.exe' : 'gifsicle')
.version('>=1.71');
In other words, if defaultBaseUrl()
is invoked, its value will be pre-pended to all values provided via src()
(inserting a slash if necessary), with the possibility of overriding said default base URL using the environment variable named after the value supplied to baseOverrideEnvName()
or the configuration key named after the value supplied to baseOverrideConfigName()
.
Is that what you had in mind?
My idea above still doesn't allow the base URL to be parameterized as in the imagemin/mozjpeg-bin case, unless the v${pkg.version}/vendor/
portion is repeated in each src()
invocations.
I have the same issue with this package, it is a dependencie from gatsby-plugin-sharp
, that I need to display images in that are in markdown. This solution provided is similar to the one I have seen on sharp
.
Thanks for the PR, but this should be solved in https://github.com/kevva/bin-wrapper, not in every binary module individually.