musescore-downloader/src/npm-data.ts

22 lines
560 B
TypeScript
Raw Normal View History

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