Port `Settings` and `OS` to TypeScript
parent
38b23c6627
commit
a102016ed8
@ -1,7 +0,0 @@
|
|||||||
/* eslint-env node */
|
|
||||||
|
|
||||||
exports.isMacOS = () => process.platform === 'darwin';
|
|
||||||
|
|
||||||
exports.isLinux = () => process.platform === 'linux';
|
|
||||||
|
|
||||||
exports.isWindows = () => process.platform === 'win32';
|
|
@ -1,3 +0,0 @@
|
|||||||
const OS = require('../os');
|
|
||||||
|
|
||||||
exports.isAudioNotificationSupported = () => !OS.isLinux();
|
|
@ -0,0 +1,15 @@
|
|||||||
|
import is from '@sindresorhus/is';
|
||||||
|
import os from 'os';
|
||||||
|
import semver from 'semver';
|
||||||
|
|
||||||
|
export const isMacOS = () => process.platform === 'darwin';
|
||||||
|
export const isLinux = () => process.platform === 'linux';
|
||||||
|
export const isWindows = (minVersion?: string) => {
|
||||||
|
const isPlatformValid = process.platform === 'win32';
|
||||||
|
const osRelease = os.release();
|
||||||
|
const isVersionValid = is.undefined(minVersion)
|
||||||
|
? true
|
||||||
|
: semver.gte(osRelease, minVersion);
|
||||||
|
|
||||||
|
return isPlatformValid && isVersionValid;
|
||||||
|
};
|
@ -0,0 +1,4 @@
|
|||||||
|
import * as OS from '../OS';
|
||||||
|
|
||||||
|
export const isAudioNotificationSupported = () =>
|
||||||
|
OS.isWindows() || OS.isMacOS();
|
Loading…
Reference in New Issue