Multiple versions with __dirname (#515)

* Multiple versions with __dirname

* Fallback for __dirname

* Update path

* Flatten versions extracted

* Expand display for versions
This commit is contained in:
Jaco Greeff
2020-02-03 13:21:46 +01:00
committed by GitHub
parent d3f6f3621b
commit f4be1fe52e
4 changed files with 49 additions and 11 deletions
+8 -1
View File
@@ -7,15 +7,22 @@ import { decodeAddress, encodeAddress, setSS58Format } from '@polkadot/util-cryp
import Keyring from './keyring';
let dirname = 'node_modules';
let pkgJson;
try {
dirname = __dirname;
} catch (error) {
// ignore
}
try {
pkgJson = require('./package.json');
} catch (error) {
pkgJson = require('../package.json');
}
detectPackage(pkgJson);
detectPackage(dirname, pkgJson);
export default Keyring;