mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 08:16:25 +00:00
check for mahor version for updates
This commit is contained in:
parent
805bed7db1
commit
190eca6f6e
@ -17,12 +17,14 @@
|
||||
"typescript": "^3.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/semver": "^7.3.4",
|
||||
"axios": "^0.19",
|
||||
"clitastic": "^0.1.2",
|
||||
"colors": "^1",
|
||||
"commander": "^6.2",
|
||||
"cron-parser": "2.x.x",
|
||||
"js-yaml": "3.x.x",
|
||||
"semver": "^7.3.5",
|
||||
"uhrwerk": "1.x.x"
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { chmodSync } from 'fs'
|
||||
|
||||
import axios from 'axios'
|
||||
import { Writer } from 'clitastic'
|
||||
import semver from 'semver'
|
||||
|
||||
import { INSTALL_DIR, VERSION } from '..'
|
||||
import { checkIfResticIsAvailable, downloadFile, exec } from '../utils'
|
||||
@ -18,6 +19,11 @@ export async function upgrade() {
|
||||
responseType: 'json',
|
||||
})
|
||||
|
||||
const latest = semver.coerce(json.tag_name)
|
||||
const current = semver.coerce(VERSION)
|
||||
if (!latest || !current) throw new Error('Could not parse versions numbers.')
|
||||
if (semver.gt(latest, current) && semver.major(latest) === semver.major(current)) {
|
||||
// Update to compatible
|
||||
if (json.tag_name != VERSION) {
|
||||
const platformMap: { [key: string]: string } = {
|
||||
darwin: 'macos',
|
||||
@ -32,6 +38,7 @@ export async function upgrade() {
|
||||
|
||||
chmodSync(to, 0o755)
|
||||
}
|
||||
}
|
||||
|
||||
w.done('All up to date! 🚀')
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import install from './handlers/install'
|
||||
import { uninstall } from './handlers/uninstall'
|
||||
import { upgrade } from './handlers/upgrade'
|
||||
|
||||
export const VERSION = '0.27'
|
||||
export const VERSION = '0.28'
|
||||
export const INSTALL_DIR = '/usr/local/bin'
|
||||
|
||||
let requireConfig: boolean = true
|
||||
|
Loading…
Reference in New Issue
Block a user