@take2identity/verosint 0.2.74 → 0.2.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/postinstall.js +12 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@take2identity/verosint",
3
- "version": "0.2.74",
3
+ "version": "0.2.76",
4
4
  "description": "Official CLI to interact with Verosint API",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -3,7 +3,7 @@
3
3
  "use strict"
4
4
 
5
5
  const { join } = require('path');
6
- const { exec } = require('child_process');
6
+ const { spawnSync } = require('child_process');
7
7
  const { existsSync, chmodSync, copyFileSync, unlinkSync, createWriteStream, readFileSync } = require('fs');
8
8
  const mkdirp = require('mkdirp');
9
9
  const axios = require('axios')
@@ -27,31 +27,27 @@ const PLATFORM_MAPPING = {
27
27
  };
28
28
 
29
29
  function getInstallationPath(callback) {
30
-
31
30
  // `npm bin` will output the path where binary files should be installed
32
- exec('npm bin', (err, stdout, stderr) => {
33
- let dir = null;
34
- if (err || stderr || !stdout || stdout.length === 0) {
35
-
31
+ const {err, stdout, stderr} = spawnSync('npm bin');
32
+ let dir = null;
33
+ if (err || stderr || !stdout || stdout.length === 0) {
36
34
  // We couldn't infer path from `npm bin`. Let's try to get it from
37
35
  // Environment variables set by NPM when it runs.
38
36
  // npm_config_prefix points to NPM's installation directory where `bin` folder is available
39
37
  // Ex: /Users/foo/.nvm/versions/node/v4.3.0
40
38
  const env = process.env;
41
-
42
39
  if (env?.npm_config_prefix) {
43
- dir = join(env.npm_config_prefix, 'bin');
40
+ dir = join(env.npm_config_prefix, 'bin');
44
41
  } else {
45
- return callback(new Error('Error finding binary installation directory'));
42
+ return callback(new Error('Error finding binary installation directory'));
46
43
  }
47
- } else {
44
+ } else {
48
45
  dir = stdout.trim();
49
- }
50
-
51
- dir = dir.replace(/node_modules.*[/\\]\.bin/, join('node_modules', '.bin'));
52
- mkdirp.sync(dir);
53
- callback(null, dir);
54
- });
46
+ }
47
+
48
+ dir = dir.replace(/node_modules.*[/\\]\.bin/, join('node_modules', '.bin'));
49
+ mkdirp.sync(dir);
50
+ callback(null, dir);
55
51
  }
56
52
 
57
53
  function verifyAndPlaceBinary(binName, callback) {