Skip to content

Commit 34b1f1f

Browse files
committedSep 12, 2020
fix(postinstall): skip postinstall if "SYSTEM_BINARY" is set
- skip "mongodb-memory-server"'s postinstall if "SYSTEM_BINARY" is set - disable eslint-rule "@typescript-eslint/no-var-requires" for all postinstalls closes #370
1 parent 82606d8 commit 34b1f1f

File tree

7 files changed

+23
-4
lines changed

7 files changed

+23
-4
lines changed
 

‎packages/mongodb-memory-server-global-3.4/postinstall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
function isModuleExists(name) {
24
try {
35
return !!require.resolve(name);

‎packages/mongodb-memory-server-global-3.6/postinstall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
function isModuleExists(name) {
24
try {
35
return !!require.resolve(name);

‎packages/mongodb-memory-server-global-4.0/postinstall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
function isModuleExists(name) {
24
try {
35
return !!require.resolve(name);

‎packages/mongodb-memory-server-global-4.2/postinstall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
function isModuleExists(name) {
24
try {
35
return !!require.resolve(name);

‎packages/mongodb-memory-server-global-4.4/postinstall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
function isModuleExists(name) {
24
try {
35
return !!require.resolve(name);

‎packages/mongodb-memory-server-global/postinstall.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
function isModuleExists(name) {
24
try {
35
return !!require.resolve(name);

‎packages/mongodb-memory-server/postinstall.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint @typescript-eslint/no-var-requires: 0 */
2+
13
/*
24
This script is used as postinstall hook.
35
@@ -20,19 +22,24 @@ if (!isModuleExists('../mongodb-memory-server-core/lib/util/resolve-config')) {
2022
console.log('Could not resolve postinstall configuration');
2123
return;
2224
}
23-
// eslint-disable-next-line @typescript-eslint/no-var-requires
25+
2426
const rc = require('../mongodb-memory-server-core/lib/util/resolve-config');
2527
rc.reInitializePackageJson(process.env.INIT_CWD);
2628

2729
const envDisablePostinstall = rc.default('DISABLE_POSTINSTALL');
28-
const skipDownload =
29-
typeof envDisablePostinstall === 'string' && rc.envToBool(envDisablePostinstall);
3030

31-
if (skipDownload) {
31+
if (typeof envDisablePostinstall === 'string' && rc.envToBool(envDisablePostinstall)) {
3232
console.log('Download is skipped by MONGOMS_DISABLE_POSTINSTALL variable');
3333
process.exit(0);
3434
}
3535

36+
const envSystemBinary = rc.default('SYSTEM_BINARY');
37+
38+
if (typeof envSystemBinary === 'string') {
39+
console.log('Download is skipped by MONGOMS_SYSTEM_BINARY variable');
40+
process.exit(0);
41+
}
42+
3643
const mongoBinaryModule = '../mongodb-memory-server-core/lib/util/MongoBinary';
3744
if (isModuleExists(mongoBinaryModule)) {
3845
const MongoBinary = require(mongoBinaryModule).default;

0 commit comments

Comments
 (0)
Please sign in to comment.