add functions to check if msdl is running
This commit is contained in:
parent
7bb3aaf7b1
commit
46a7f50115
1 changed files with 16 additions and 0 deletions
16
src/npm-data.ts
Normal file
16
src/npm-data.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { exec as _exec } from 'child_process';
|
||||||
|
import { promisify } from 'util';
|
||||||
|
|
||||||
|
const exec = promisify(_exec);
|
||||||
|
|
||||||
|
export async function isNpx() {
|
||||||
|
const output = await exec('npm list -g musescore-downloader')
|
||||||
|
return output.stdout.includes('(empty)');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function isLatest() {
|
||||||
|
const version = (/musescore-downloader@([\d\.]+)/).exec((await exec('npm list -g musescore-downloader')).stdout)![1]
|
||||||
|
const latest = (await exec('npm info musescore-downloader version')).stdout.trim()
|
||||||
|
|
||||||
|
return version.trim() === latest
|
||||||
|
}
|
Loading…
Reference in a new issue