Skip to content

Commit

Permalink
Require Node.js 18
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
sindresorhus committed Nov 24, 2023
1 parent ff7af80 commit ce0435b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 34 deletions.
4 changes: 0 additions & 4 deletions .github/funding.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 20
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function osName(platform, release) {
throw new Error('You can\'t specify a `release` without specifying `platform`');
}

platform = platform || os.platform();
platform = platform ?? os.platform();

let id;

Expand Down
4 changes: 2 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os from 'node:os';
import {platform, release} from 'node:os';
import {expectType} from 'tsd';
import osName from './index.js';

expectType<string>(osName());
expectType<string>(osName(os.platform(), os.release()));
expectType<string>(osName(platform(), release()));
expectType<string>(osName('darwin', '14.0.0'));
expectType<string>(osName('linux', '3.13.0-24-generic'));
expectType<string>(osName('win32', '6.3.9600'));
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsd"
Expand All @@ -36,13 +40,13 @@
"linux"
],
"dependencies": {
"macos-release": "^3.1.0",
"windows-release": "^5.0.1"
"macos-release": "^3.2.0",
"windows-release": "^6.0.0"
},
"devDependencies": {
"@types/node": "^16.11.7",
"ava": "^3.15.0",
"tsd": "^0.18.0",
"xo": "^0.46.4"
"@types/node": "^20.10.0",
"ava": "^5.3.1",
"tsd": "^0.29.0",
"xo": "^0.56.0"
}
}
16 changes: 0 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ 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">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-os-name?utm_source=npm-os-name&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

0 comments on commit ce0435b

Please sign in to comment.