aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-12-27 09:45:29 +0800
committerJacob Evans <jacob@dekz.net>2018-12-27 09:45:29 +0800
commit9d5d0dbe144fe63469d2830c6da95940c7a78206 (patch)
treecac0f0e147dccdc7a10aa1c066a6624e3e5aa6c1 /packages/migrations/src
parent2b7875571d8a7a980eab82633b80750458b9e80b (diff)
downloaddexon-0x-contracts-9d5d0dbe144fe63469d2830c6da95940c7a78206.tar.gz
dexon-0x-contracts-9d5d0dbe144fe63469d2830c6da95940c7a78206.tar.zst
dexon-0x-contracts-9d5d0dbe144fe63469d2830c6da95940c7a78206.zip
Readme, read snapshot name from package.json
Diffstat (limited to 'packages/migrations/src')
-rw-r--r--packages/migrations/src/migrate_snapshot.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/migrations/src/migrate_snapshot.ts b/packages/migrations/src/migrate_snapshot.ts
index f9b7751a5..13fb063da 100644
--- a/packages/migrations/src/migrate_snapshot.ts
+++ b/packages/migrations/src/migrate_snapshot.ts
@@ -2,6 +2,9 @@
import { devConstants, web3Factory } from '@0x/dev-utils';
import { logUtils } from '@0x/utils';
import { Provider } from 'ethereum-types';
+import * as fs from 'fs';
+import * as _ from 'lodash';
+import * as path from 'path';
import { runMigrationsAsync } from './migration';
@@ -9,8 +12,14 @@ import { runMigrationsAsync } from './migration';
let providerConfigs;
let provider: Provider;
let txDefaults;
+ const packageJsonPath = path.join(__dirname, '..', 'package.json');
+ const packageJsonString = fs.readFileSync(packageJsonPath, 'utf8');
+ const packageJson = JSON.parse(packageJsonString);
+ if (_.isUndefined(packageJson.config) || _.isUndefined(packageJson.config.snapshot_name)) {
+ throw new Error(`Did not find 'snapshot_name' key in package.json config`);
+ }
- providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: '0x_ganache_snapshot' };
+ providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: packageJson.config.snapshot_name };
provider = web3Factory.getRpcProvider(providerConfigs);
txDefaults = {
from: devConstants.TESTRPC_FIRST_ADDRESS,