Skip to content

Commit 572b9e6

Browse files
authored
Merge pull request #7 from douglasduteil/patch-1
feat(postinstall): allow environment variable to be in the .npmrc
2 parents d5c6ff2 + e7f44f4 commit 572b9e6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/install.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ const request = require("request");
44
const fileName = require("./file-name");
55

66
if (fs.existsSync(fileName.qualifiedName)) { return; }
7-
if (process.env["NATIVE_IMAGE_DIFF_SKIP_BINARY_DOWNLOAD_FOR_CI"]) { return; }
7+
if (
8+
process.env["NATIVE_IMAGE_DIFF_SKIP_BINARY_DOWNLOAD_FOR_CI"] ||
9+
process.env["npm_config_native_image_diff_skip_binary_download_for_ci"]
10+
) {
11+
return;
12+
}
813

914
// Get the version of the library;
1015
const pkg = require(path.resolve(__dirname, "..", "package.json"));
1116
const packageVersion = pkg.version;
12-
const baseUrl = process.env.NATIVE_IMAGE_DIFF_BINARY_URL || "https://github.com/Prior99/native-image-diff/releases/download";
17+
const baseUrl =
18+
process.env["NATIVE_IMAGE_DIFF_BINARY_URL"] ||
19+
process.env["npm_config_native_image_diff_binary_url"] ||
20+
"https://github.com/Prior99/native-image-diff/releases/download";
1321
const url = `${baseUrl}/${packageVersion}/${fileName.baseName}`;
1422

1523
console.info(`Downloading native-image-diff prebuilt binary from "${url}".`);

0 commit comments

Comments
 (0)