trm-core 8.2.3 → 8.2.4

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/changelog.txt CHANGED
@@ -8,6 +8,10 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2026-02-17 v8.2.4
12
+ -------------------
13
+ * npm global path
14
+
11
15
  2026-02-17 v8.2.3
12
16
  -------------------
13
17
  * find dependencies in publish action
@@ -5,32 +5,53 @@ const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
6
  const trm_commons_1 = require("trm-commons");
7
7
  function getNodePackage(packageName) {
8
- if (!packageName) {
9
- packageName = 'trm-core';
10
- }
11
- trm_commons_1.Logger.loading(`Looking for "${packageName}" package.json, starting in folder "${process.cwd()}"...`, true);
12
- var data;
13
- try {
14
- data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(process.cwd(), 'package.json'), 'utf8'));
15
- if (data.name === packageName) {
16
- return data;
8
+ const globalPath = (0, trm_commons_1.getGlobalNodeModules)();
9
+ if (__dirname.includes(globalPath)) {
10
+ const parts = __dirname.split(node_path_1.sep);
11
+ const index = parts.lastIndexOf("node_modules");
12
+ if (packageName) {
13
+ try {
14
+ return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(parts.slice(0, index + 1).join(node_path_1.sep), packageName, 'package.json'), 'utf8'));
15
+ }
16
+ catch (_a) { }
17
+ try {
18
+ const data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(parts.slice(0, index + 1).join(node_path_1.sep), '..'), 'package.json'), 'utf8'));
19
+ if (data.name === packageName) {
20
+ return data;
21
+ }
22
+ }
23
+ catch (_b) { }
24
+ }
25
+ else {
26
+ try {
27
+ return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(parts.slice(0, index + 1).join(node_path_1.sep), 'trm-core', 'package.json'), 'utf8'));
28
+ }
29
+ catch (_c) { }
17
30
  }
18
31
  }
19
- catch (_a) { }
20
- try {
21
- data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(process.cwd(), 'node_modules', packageName, 'package.json'), 'utf8'));
22
- return data;
23
- }
24
- catch (_b) { }
25
- try {
26
- data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(process.cwd(), ".."), packageName, 'package.json'), 'utf8'));
27
- return data;
28
- }
29
- catch (_c) { }
30
- try {
31
- data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(process.cwd(), ".."), 'node_modules', packageName, 'package.json'), 'utf8'));
32
- return data;
32
+ else {
33
+ if (!packageName) {
34
+ packageName = 'trm-core';
35
+ }
36
+ try {
37
+ const data = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(process.cwd(), 'package.json'), 'utf8'));
38
+ if (data.name === packageName) {
39
+ return data;
40
+ }
41
+ }
42
+ catch (_d) { }
43
+ try {
44
+ return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(process.cwd(), 'node_modules', packageName, 'package.json'), 'utf8'));
45
+ }
46
+ catch (_e) { }
47
+ try {
48
+ return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(process.cwd(), ".."), packageName, 'package.json'), 'utf8'));
49
+ }
50
+ catch (_f) { }
51
+ try {
52
+ return JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.resolve)(process.cwd(), ".."), 'node_modules', packageName, 'package.json'), 'utf8'));
53
+ }
54
+ catch (_g) { }
33
55
  }
34
- catch (_d) { }
35
56
  throw new Error(`Couldn't find "${packageName}" package.json!`);
36
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trm-core",
3
- "version": "8.2.3",
3
+ "version": "8.2.4",
4
4
  "description": "TRM (Transport Request Manager) Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,6 @@
16
16
  "scripts": {
17
17
  "cleanBuild": "rimraf dist/",
18
18
  "build": "npm run cleanBuild && tsc --sourceMap false",
19
- "test": "jest",
20
19
  "prepublishOnly": "npm run build",
21
20
  "postinstall": "node dist/scripts/checkEngine.js"
22
21
  },
@@ -69,7 +68,7 @@
69
68
  "xml-js": "^1.6.11"
70
69
  },
71
70
  "peerDependencies": {
72
- "trm-commons": "^3.4.3"
71
+ "trm-commons": "3.4.3"
73
72
  },
74
73
  "devDependencies": {
75
74
  "@types/adm-zip": "^0.5.0",
@@ -77,7 +76,6 @@
77
76
  "@types/debug": "^4.1.12",
78
77
  "@types/express": "^4.17.17",
79
78
  "@types/inquirer": "^9.0.3",
80
- "@types/jest": "^29.5.12",
81
79
  "@types/lodash": "^4.14.202",
82
80
  "@types/node": "^20.4.4",
83
81
  "@types/opener": "^1.4.0",
@@ -85,10 +83,8 @@
85
83
  "@types/semver-sort": "^0.0.1",
86
84
  "@types/stack-trace": "^0.0.33",
87
85
  "@types/uuid": "^9.0.8",
88
- "jest": "^29.7.0",
89
86
  "rimraf": "^6.0.1",
90
- "trm-commons": "^3.4.2",
91
- "ts-jest": "^29.1.2",
87
+ "trm-commons": "3.4.3",
92
88
  "ts-node": "^10.9.2",
93
89
  "typescript": "^5.8.2"
94
90
  },