We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04d9090 commit 18d530cCopy full SHA for 18d530c
src/sdk/Utils/Utils.ts
@@ -16,12 +16,16 @@ export class Utils {
16
17
public static getPackageVersion(): string {
18
if (!this.PackageJSON) {
19
- const packageJsonPaths = ['../../../package.json', '../../../../package.json'];
20
- for (const packageJsonPath in packageJsonPaths) {
+ const path = require('path');
+ const possiblePackageJsonPaths = [
21
+ path.join(__dirname, '../../../../package.json'),
22
+ path.join(__dirname, '../../../package.json')
23
+ ];
24
+ for (const packageJsonPath of possiblePackageJsonPaths) {
25
try {
26
this.PackageJSON = require(packageJsonPath);
27
} catch (e) {}
- if (!this.PackageJSON) break;
28
+ if (this.PackageJSON) break;
29
}
30
31
return this.PackageJSON.version
0 commit comments