Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for setting custom binary site #90

Closed
wants to merge 4 commits into from

Conversation

d0whc3r
Copy link

@d0whc3r d0whc3r commented Sep 10, 2018

No description provided.

@sindresorhus
Copy link
Contributor

Thanks for the PR, but this should be solved in https://github.com/kevva/bin-wrapper, not in every binary module individually.

@raymondwu1
Copy link

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?

@olivierdagenais
Copy link

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?

@olivierdagenais
Copy link

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.

@ambroiseRabier
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants