UNPKG

vasku

Version:

TVM-Solidity contract development framework

36 lines (35 loc) 1.39 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.init = void 0; const path_1 = __importDefault(require("path")); const fs_extra_1 = __importDefault(require("fs-extra")); const child_process_1 = require("child_process"); const PATH = '../../../../init'; const INSTALL_COMMAND = 'yarn install'; const ENV_COMMAND = 'yarn env'; const COPY_COMMAND = 'yarn copy'; function init(target = process.cwd()) { copyInitFiles(target); installPackages(); } exports.init = init; function copyInitFiles(target) { const source = path_1.default.resolve(__dirname, PATH); fs_extra_1.default.readdirSync(source).forEach((value) => { fs_extra_1.default.copySync(path_1.default.resolve(source, value), path_1.default.resolve(target, value), { overwrite: true }); }); } function installPackages() { try { (0, child_process_1.execSync)(INSTALL_COMMAND, { stdio: 'inherit' }); (0, child_process_1.execSync)(ENV_COMMAND, { stdio: 'inherit' }); (0, child_process_1.execSync)(COPY_COMMAND, { stdio: 'inherit' }); (0, child_process_1.execSync)(INSTALL_COMMAND, { stdio: 'inherit' }); // Reinstall with node_modules } catch (error) { console.error(error); } }