2021-01-15 08:06:31 +00:00
|
|
|
import { exec as _exec } from 'child_process'
|
|
|
|
import { promisify } from 'util'
|
2021-01-15 07:54:01 +00:00
|
|
|
|
2021-01-15 08:06:31 +00:00
|
|
|
const exec = promisify(_exec)
|
2021-01-15 07:54:01 +00:00
|
|
|
|
|
|
|
export async function isNpx() {
|
2021-01-15 07:55:06 +00:00
|
|
|
const output = await exec('npm list -g musescore-downloader')
|
2021-01-15 08:06:31 +00:00
|
|
|
return output.stdout.includes('(empty)')
|
2021-01-15 07:54:01 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 08:01:11 +00:00
|
|
|
export async function installedVersion() {
|
2021-01-20 15:42:33 +00:00
|
|
|
return require('../package.json').version
|
2021-01-15 08:01:11 +00:00
|
|
|
}
|
2021-01-15 07:54:01 +00:00
|
|
|
|
2021-01-15 08:01:11 +00:00
|
|
|
export async function latestVersion() {
|
|
|
|
return (await exec('npm info musescore-downloader version')).stdout.trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function isLatest() {
|
|
|
|
return await installedVersion() === await latestVersion()
|
2021-01-20 15:42:33 +00:00
|
|
|
}
|