From a1adfb8e6761e254e90a08626e2e49e2f9ede524 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 29 Aug 2020 21:58:55 +0200 Subject: [PATCH] Require Node.js 10 Fixes #11 --- .travis.yml | 4 ++-- index.js | 6 +++++- license | 2 +- package.json | 15 ++++++++------- readme.md | 10 ++-------- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ae9d62..9d7745e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: + - '14' + - '12' - '10' - - '8' - - '6' diff --git a/index.js b/index.js index f1287d5..6e25f86 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,11 @@ const osName = (platform, release) => { } const prefix = release ? (Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X') : 'macOS'; - id = release ? macosRelease(release).name : ''; + + try { + id = release ? macosRelease(release).name : ''; + } catch {} + return prefix + (id ? ' ' + id : ''); } diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index 49f84f3..9b697e9 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "description": "Get the name of the current operating system. Example: macOS Sierra", "license": "MIT", "repository": "sindresorhus/os-name", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=10" }, "scripts": { "test": "xo && ava && tsd" @@ -34,12 +35,12 @@ ], "dependencies": { "macos-release": "^2.2.0", - "windows-release": "^3.1.0" + "windows-release": "^4.0.0" }, "devDependencies": { - "@types/node": "^11.13.0", - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "@types/node": "^14.6.2", + "ava": "^2.4.0", + "tsd": "^0.13.1", + "xo": "^0.33.0" } } diff --git a/readme.md b/readme.md index b61e3aa..9e70546 100644 --- a/readme.md +++ b/readme.md @@ -1,18 +1,16 @@ -# os-name [![Build Status](https://travis-ci.org/sindresorhus/os-name.svg?branch=master)](https://travis-ci.org/sindresorhus/os-name) +# os-name [![Build Status](https://travis-ci.com/sindresorhus/os-name.svg?branch=master)](https://travis-ci.com/github/sindresorhus/os-name) -> Get the name of the current operating system
+> Get the name of the current operating system\ > Example: `macOS Sierra` Useful for analytics and debugging. - ## Install ``` $ npm install os-name ``` - ## Usage ```js @@ -37,7 +35,6 @@ osName('win32', '6.3.9600'); //=> 'Windows 8.1' ``` - ## API ### osName(platform?, release?) @@ -48,17 +45,14 @@ You can optionally supply a custom [`os.platform()`](https://nodejs.org/api/os.h Check out [`getos`](https://github.com/wblankenship/getos) if you need the Linux distribution name. - ## Contributing Production systems depend on this package for logging / tracking. Please be careful when introducing new output, and adhere to existing output format (whitespace, capitalization, etc.). - ## Related - [os-name-cli](https://github.com/sindresorhus/os-name-cli) - CLI for this module - ---