@rxap/node-utilities
Advanced tools
Comparing version
@@ -6,2 +6,8 @@ # Change Log | ||
# [1.3.0-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/node-utilities@1.2.3-dev.0...@rxap/node-utilities@1.3.0-dev.0) (2024-06-18) | ||
### Features | ||
- use the rxap package to resolve package versions ([d499a8a](https://gitlab.com/rxap/packages/commit/d499a8a0e7e6f7ee0b54e9f14bf77509ff7ae910)) | ||
## [1.2.3-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/node-utilities@1.2.2...@rxap/node-utilities@1.2.3-dev.0) (2024-06-17) | ||
@@ -8,0 +14,0 @@ |
{ | ||
"version": "1.2.3-dev.0", | ||
"version": "1.3.0-dev.0", | ||
"name": "@rxap/node-utilities", | ||
@@ -36,4 +36,4 @@ "license": "GPL-3.0-or-later", | ||
"type": "commonjs", | ||
"gitHead": "a86ff17c44a01ef4a847db848aed3ae7ce6fa954", | ||
"gitHead": "a261f463bc7d9023674bf53bbbc80d80df38a906", | ||
"main": "./src/index.js" | ||
} |
@@ -21,7 +21,36 @@ "use strict"; | ||
} | ||
function hasRxapPackage() { | ||
try { | ||
const packageJsonFilePath = require.resolve('rxap'); | ||
return true; | ||
} | ||
catch (e) { | ||
console.log('No rxap package found: ' + e.message); | ||
} | ||
return false; | ||
} | ||
function getRxapPackageJson() { | ||
try { | ||
const packageJsonFilePath = require.resolve('rxap/package.json'); | ||
return require(packageJsonFilePath); | ||
} | ||
catch (e) { | ||
throw new Error('No rxap package found: ' + e.message); | ||
} | ||
} | ||
function GetLatestPackageVersion(packageName, skipCache) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
var _a, _b; | ||
if (!skipCache && LATEST_PACKAGE_VERSIONS[packageName]) { | ||
return LATEST_PACKAGE_VERSIONS[packageName]; | ||
} | ||
if (hasRxapPackage()) { | ||
const rxapPackageJson = getRxapPackageJson(); | ||
const packageGroupList = (_b = (_a = rxapPackageJson['nx-migrations']) === null || _a === void 0 ? void 0 : _a.packageGroup) !== null && _b !== void 0 ? _b : []; | ||
const packageGroup = packageGroupList.find(group => group.package === packageName); | ||
if (packageGroup) { | ||
updateLastPackageVersionCache(packageName, packageGroup.version); | ||
return packageGroup.version; | ||
} | ||
} | ||
const info = yield (0, get_package_info_1.GetPackageInfo)(packageName, skipCache); | ||
@@ -28,0 +57,0 @@ if (info) { |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
96475
2.36%739
4.08%10
11.11%