UNPKG

vasku

Version:

TVM-Solidity contract development framework

47 lines (46 loc) 1.63 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = void 0; const compile_1 = require("./compile"); const createGlobal_1 = require("../global/createGlobal"); const se_1 = require("./common/se"); const path_1 = __importDefault(require("path")); const fs_extra_1 = __importDefault(require("fs-extra")); const colors_1 = require("colors"); async function run(config, script, network = se_1.SE, compilation = true) { /////////////////// // Create global // /////////////////// await (0, createGlobal_1.createGlobal)(config, network); /////////// // Up SE // /////////// await (0, se_1.upSeIfNotActive)(network, config.se); ///////////// // Compile // ///////////// if (compilation) await (0, compile_1.compile)(config); //////////////// // Check file // //////////////// const file = path_1.default.resolve(process.cwd(), config.paths.scripts, script); const fileTs = file + '.ts'; const fileExist = fs_extra_1.default.existsSync(file); const fileTsExist = fs_extra_1.default.existsSync(fileTs); if (!fileExist && !fileTsExist) { console.error((0, colors_1.red)(`${(0, colors_1.yellow)(script)} not found in scripts directory`)); process.exit(); } ///////// // Run // ///////// if (fileTsExist) require(fileTs); // eslint-disable-line else if (fileExist) require(file); // eslint-disable-line } exports.run = run;