Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
sindresorhus committed Aug 29, 2020
1 parent 6e18891 commit a1adfb8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
- '6'
6 changes: 5 additions & 1 deletion index.js
Expand Up @@ -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 : '');
}

Expand Down
2 changes: 1 addition & 1 deletion license
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:

Expand Down
15 changes: 8 additions & 7 deletions package.json
Expand Up @@ -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"
Expand All @@ -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"
}
}
10 changes: 2 additions & 8 deletions 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<br>
> Get the name of the current operating system\
> Example: `macOS Sierra`
Useful for analytics and debugging.


## Install

```
$ npm install os-name
```


## Usage

```js
Expand All @@ -37,7 +35,6 @@ osName('win32', '6.3.9600');
//=> 'Windows 8.1'
```


## API

### osName(platform?, release?)
Expand All @@ -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


---

<div align="center">
Expand Down

0 comments on commit a1adfb8

Please sign in to comment.