upd cli
- added rpc tests - removed git clone
This commit is contained in:
1 parent
39e6455271
commit
828a3deb33
7 files changed
+175
-58
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { exec } from 'child_process'
|
||||
|
||||
export async function cloneBranch(link: string, path: string, branch: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const args = ['--single-branch', '-b', branch, '--', link, path]
|
||||
const proc = exec('git clone ' + args.join(' '))
|
||||
|
||||
proc.on('close', (status: number) => {
|
||||
if (status == 0) {
|
||||
resolve(true)
|
||||
} else if (status == 128) {
|
||||
reject(
|
||||
`Folder already exists. 'git clone' from branch ${branch} failed with status ` +
|
||||
status,
|
||||
)
|
||||
} else {
|
||||
reject(
|
||||
`'git clone' from branch ${branch} failed with status ` +
|
||||
status,
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import axios from 'axios'
|
||||
import c from 'chalk'
|
||||
import yargs from 'yargs'
|
||||
|
||||
@@ -10,12 +9,15 @@ type Version = {
|
||||
message: string
|
||||
}
|
||||
|
||||
export async function checkForUpdate(): Promise<void> {
|
||||
export async function checkForUpdates(): Promise<void> {
|
||||
const ky = await import('ky').then(ky => ky.default)
|
||||
|
||||
return new Promise(res => {
|
||||
yargs.showVersion(version =>
|
||||
axios
|
||||
ky
|
||||
.get<Version[]>(latestVersionURL)
|
||||
.then(({ data }) => {
|
||||
.then(response => response.json<Version[]>())
|
||||
.then(data => {
|
||||
const latestVersion = data[0].name
|
||||
|
||||
if (latestVersion !== `v${version}`)
|
||||
|
||||
Reference in new issue
Block a user