UNPKG

@titan-suite/cli

Version:

The complete smart contract development tool

46 lines (45 loc) 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const command_1 = require("@oclif/command"); const fs = require("fs"); const path = require("path"); const deploy_1 = require("./deploy"); class Migrate extends command_1.Command { run() { return tslib_1.__awaiter(this, void 0, void 0, function* () { const { args } = this.parse(Migrate); const deployer = new deploy_1.default([''], this.config); // TODO pass params let migrationFile; if (args.file) { migrationFile = path.join(process.cwd(), `${args.file}`); if (!fs.existsSync(migrationFile)) this.error('The migration file does not exist'); const migration = require(migrationFile); migration(deployer); } else { // TODO loop through migrations folder } }); } } Migrate.description = 'Run migrations to deploy contracts'; Migrate.examples = [ '$ titan migrate', '$ titan migrate <path/to/migrate/migrateExample.js>', '$ titan migrate -t development <path/to/migrate/migrateExample.js>' ]; Migrate.args = [{ name: 'file' }]; Migrate.flags = { help: command_1.flags.help({ char: 'h' }), privateKey: command_1.flags.boolean({ char: 'k', description: 'pass parameters to the smart contract' }), network: command_1.flags.string({ char: 't', description: 'specify the network to deploy the smart contract' }) }; exports.default = Migrate;