Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	cli/src/commands/create.ts
This commit is contained in:
2024-06-13 19:27:36 +01:00
5 changed files with 52 additions and 5 deletions
+3
View File
@@ -1,6 +1,9 @@
import yargs from 'yargs'
import create from './commands/create'
import { checkForUpdate } from './utils/update'
yargs.middleware(checkForUpdate)
yargs
.usage('<cmd> [args]')
+28
View File
@@ -0,0 +1,28 @@
import axios from 'axios'
import c from 'chalk'
import yargs from 'yargs'
const latestVersionURL =
'https://git.entityseven.com/api/v1/repos/entityseven/rage-framework/tags?page=1&limit=1'
type Version = {
name: string
message: string
}
export async function checkForUpdate() {
yargs.showVersion(version =>
axios.get<Version[]>(latestVersionURL).then(({ data }) => {
const latestVersion = data[0].name
if (!(latestVersion === version))
notifyUserAboutUpdate(latestVersion)
return
}),
)
}
function notifyUserAboutUpdate(version: string) {
console.log(c.green(`Update available. New version: ${version}`))
}