mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix: detect core version before including inspector_modules on android (#10520)
This commit is contained in:
@ -47,3 +47,23 @@ export function getDependencyPath(dependencyName: string): string | null {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to get the version of a dependency.
|
||||
*
|
||||
* @param dependencyName
|
||||
* @returns string | null - version of the dependency or null if not found
|
||||
*/
|
||||
export function getDependencyVersion(dependencyName: string): string | null {
|
||||
const dependencyPath = getDependencyPath(dependencyName);
|
||||
if (!dependencyPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return require(`${dependencyPath}/package.json`).version;
|
||||
} catch (err) {
|
||||
// ignore
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user