@criticalmanufacturing/cli 5.10.4 → 5.10.7

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.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@criticalmanufacturing/cli",
3
- "version": "5.10.4",
3
+ "version": "5.10.7",
4
4
  "description": "Critical Manufacturing command line client",
5
5
  "bin": {
6
- "cmf": "./run.js"
6
+ "cmf": "run.js"
7
7
  },
8
8
  "scripts": {
9
9
  "postinstall": "node postinstall.js install",
@@ -11,7 +11,8 @@
11
11
  "test": "jest",
12
12
  "test:watch": "jest --watch",
13
13
  "test:coverage": "jest --coverage",
14
- "test:integration": "node integration-test.js"
14
+ "test:integration": "node integration-test.js",
15
+ "prepublishOnly": "npm shrinkwrap"
15
16
  },
16
17
  "author": "Critical Manufacturing, SA",
17
18
  "license": "BSD-3-Clause",
@@ -29,7 +30,8 @@
29
30
  "dist",
30
31
  "postinstall.js",
31
32
  "run.js",
32
- "utils.js"
33
+ "utils.js",
34
+ "npm-shrinkwrap.json"
33
35
  ],
34
36
  "dependencies": {
35
37
  "adm-zip": "^0.5.12",
@@ -38,7 +40,6 @@
38
40
  "debug": "^4.3.4",
39
41
  "global-dirs": "3.0.0",
40
42
  "mkdirp": "^2.1.6",
41
- "node_modules-path": "^2.0.7",
42
43
  "rimraf": "^3.0.2",
43
44
  "tmp": "0.2.1",
44
45
  "http-proxy-agent": "^5.0.0",
package/postinstall.js CHANGED
@@ -13,7 +13,6 @@ const path = require('path'),
13
13
  AdmZip = require("adm-zip"),
14
14
  tmp = require('tmp'),
15
15
  dbg = require('debug'),
16
- node_modules = require('node_modules-path'),
17
16
  { parsePackageJson, PLATFORM_MAPPING, ARCH_MAPPING } = require('./utils');
18
17
 
19
18
  const debug = dbg("cmf:debug");
@@ -22,7 +21,10 @@ const error = dbg("cmf:debug:error");
22
21
  async function getInstallationPath() {
23
22
  debug("Getting installation path...");
24
23
  debug("Targeting node_modules/.bin/cmf-cli. Making sure path exists...");
25
- const dir = path.join(node_modules(), ".bin", "cmf-cli");
24
+ // __dirname is always <node_modules>/@criticalmanufacturing/cli, so two
25
+ // levels up is always the node_modules/ dir that owns .bin/ — whether this
26
+ // is a local install (with or without shrinkwrap) or a global install.
27
+ const dir = path.join(path.resolve(__dirname, '..', '..'), ".bin", "cmf-cli");
26
28
  await mkdirp(dir);
27
29
  debug(`Install path exists!`);
28
30
  return dir;
package/run.js CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  const { spawn } = require('child_process');
6
6
  const path = require('path');
7
- const node_modules = require('node_modules-path');
8
7
  const dbg = require('debug');
9
8
  const { parsePackageJson } = require('./utils');
10
9
 
@@ -13,7 +12,9 @@ const debug = dbg("cmf:debug");
13
12
 
14
13
  debug("Executing cmf-cli");
15
14
  debug("Getting binary from node_modules/.bin/cmf-cli...");
16
- const exePath = path.join(node_modules(), ".bin", "cmf-cli", opts.binName);
15
+ // __dirname is always <node_modules>/@criticalmanufacturing/cli, so two levels
16
+ // up is the node_modules/ that owns .bin/ — correct for local and global installs.
17
+ const exePath = path.join(path.resolve(__dirname, '..', '..'), ".bin", "cmf-cli", opts.binName);
17
18
  debug("Obtained binary path: " + exePath);
18
19
 
19
20
  debug(`Spawning cmf-cli from ${exePath} with args ${process.argv.slice(2)} and piping.`);