This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,688 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const updater = require('./updater') | ||
|
||
const chalk = require('chalk') | ||
const packageInfo = require('../../package.json') | ||
|
||
const boot = () => { | ||
return new Promise((resolve) => { | ||
console.log(chalk.blueBright('Metronami') + ' ' + chalk.whiteBright(`v${packageInfo.version}`)) | ||
console.log(chalk.gray('Repo: https://github.com/hiyamashu/Metronami | Licensed under GPL v3.0')) | ||
if (packageInfo.version.includes('-beta') || packageInfo.version.includes('-alpha')) { | ||
console.log(chalk.red('This is a beta/alpha version of Metronami. Always keep a backup of your data. Report any bugs if you find any.')) | ||
} | ||
updater().then(() => { | ||
setTimeout(() => { | ||
resolve() | ||
}, 5000) | ||
}) | ||
}) | ||
} | ||
|
||
module.exports = boot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const semver = require('semver') | ||
const getTagFor = require('get-github-tag') | ||
const download = require('download') | ||
|
||
const currentVersion = require('../../package.json').version | ||
const chalk = require('chalk') | ||
|
||
const updater = () => { | ||
return new Promise((resolve) => { | ||
getTagFor('hiyamashu', 'Metronami', '').then((tag) => { | ||
if (semver.satisfies(currentVersion, `>=${tag}`) === true) { | ||
return resolve() | ||
} | ||
|
||
console.log(chalk.greenBright(`New update found: ${tag}`)) | ||
|
||
// Url of the image | ||
const file = `https://github.com/hiyamashu/Metronami/archive/refs/tags/${tag}.zip` | ||
const filePath = `./updates` | ||
|
||
download(file, filePath) | ||
.then(() => { | ||
console.log(chalk.whiteBright('Update downloaded into /updates. Please update Metronami at your nearest convenience.')) | ||
}) | ||
|
||
resolve() | ||
}) | ||
}) | ||
} | ||
|
||
module.exports = updater |
Oops, something went wrong.