UNPKG

gotbit-tools

Version:

GotBit development tool for js

44 lines (38 loc) 967 B
const { exec } = require('child_process') const inquirer = require('inquirer') const copyGotbitTools = (type, dir) => ` cd ${dir} rm -rf gotbit-tools git clone --single-branch --branch ${type}-stable https://gitlab.bc.gotbit.io/bc/common/gotbit-tools.git gotbit-tools rm -rf gotbit-tools/.git ` function sh(command) { exec(command) } const typeList = ['vue', 'hardhat'] async function install(type, options) { if (!type) { const res = await inquirer.prompt([ { name: 'type', message: 'Name of gotbit-tools typ:', type: 'list', choices: typeList, }, ]) type = res.type } if (!options.dir) { const res = await inquirer.prompt([ { name: 'dir', message: 'Write folder name:', type: 'text', }, ]) options.dir = res.dir } console.log(`Installing "${type}-stable" in ${options.dir}/`) sh(copyGotbitTools(type, options.dir)) } module.exports = install