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

Feat/allow-for-github-raw-url #126

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ const path = require('path');
const BinWrapper = require('bin-wrapper');
const pkg = require('../package.json');

const url = `https://raw.githubusercontent.com/imagemin/pngquant-bin/v${pkg.version}/vendor/`;
const GITHUB_RAW_URL = process.env.GITHUB_RAW_URL
? process.env.GITHUB_RAW_URL
: 'https://raw.githubusercontent.com';
const url = `${GITHUB_RAW_URL}/imagemin/pngquant-bin/v${pkg.version}/vendor/`;

module.exports = new BinWrapper()
.src(`${url}macos/pngquant`, 'darwin')
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ You probably want [`imagemin-pngquant`](https://github.com/imagemin/imagemin-png
$ npm install pngquant-bin
```

If you wish to pull through your own internal mirror you can use `GITHUB_RAW_URL`
to point the postinstall step to pull through your mirror. By default, this package
attempts to install from `https://raw.githubusercontent.com` on postinstall, and compiles
otherwise if the connection can't be made.

## Usage

Expand Down