Skip to content

Commit

Permalink
install script: pull env vars for release tag & binaries URL from pac…
Browse files Browse the repository at this point in the history
…kage.json
  • Loading branch information
derhuerst committed Dec 2, 2022
1 parent 2d9dfb7 commit 06a3654
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const {createGunzip} = require('zlib')
const {pipeline} = require('stream')
var ffmpegPath = require(".");
var pkg = require("./package");
const {
'binary-release-tag-env-var': RELEASE_ENV_VAR,
'binaries-url-env-var': BINARIES_URL_ENV_VAR,
} = pkg[pkg.name]

const exitOnError = (err) => {
console.error(err)
Expand Down Expand Up @@ -153,7 +157,7 @@ function onProgress(deltaBytes, totalBytes) {
}

const release = (
process.env.FFMPEG_BINARY_RELEASE ||
process.env[RELEASE_ENV_VAR] ||
pkg['ffmpeg-static']['binary-release-tag']
)
const releaseName = (
Expand All @@ -163,7 +167,7 @@ const releaseName = (
const arch = process.env.npm_config_arch || os.arch()
const platform = process.env.npm_config_platform || os.platform()
const downloadsUrl = (
process.env.FFMPEG_BINARIES_URL ||
process.env[BINARIES_URL_ENV_VAR] ||
'https://github.com/eugeneware/ffmpeg-static/releases/download'
)
const baseUrl = `${downloadsUrl}/${release}`
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"prepublishOnly": "npm run lint && npm run install && npm test"
},
"ffmpeg-static": {
"binary-release-tag-env-var": "FFMPEG_BINARY_RELEASE",
"binary-release-tag": "b5.0.1",
"binary-release-name": "5.0.1"
"binary-release-name": "5.0.1",
"binaries-url-env-var": "FFMPEG_BINARIES_URL"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 06a3654

Please sign in to comment.