UNPKG

@lowcodeunit/lcu-cli

Version:

This is the home of the LCU DevKit and the LCU CLI code.

32 lines (28 loc) 944 B
import download from 'download-git-repo'; import rimraf from 'rimraf'; export class AsyncHelpers { static downloadGit(repo: string, downloadToPath: string, host?: 'github' | 'gitlab' | 'bitbucket') { return new Promise<void>((resolve, reject) => { if (host && !repo.startsWith(host)) repo = `${host}:${repo}`; download(repo, downloadToPath, async (err) => { if (err) { reject(err); } else { resolve(); } }); }); } static rimraf(files: string) { return new Promise<void>((resolve, reject) => { rimraf(files, async (err) => { if (err) { reject(err); } else { resolve(); } }); }); } }