trm-core 8.2.3 → 8.3.0
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 +4 -0
- package/dist/commons/getNodePackage.js +45 -24
- package/package.json +3 -7
package/changelog.txt
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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.
|
|
3
|
+
"version": "8.3.0",
|
|
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.
|
|
71
|
+
"trm-commons": "^3.5.0"
|
|
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.
|
|
91
|
-
"ts-jest": "^29.1.2",
|
|
87
|
+
"trm-commons": "^3.5.0",
|
|
92
88
|
"ts-node": "^10.9.2",
|
|
93
89
|
"typescript": "^5.8.2"
|
|
94
90
|
},
|