Skip to content

Commit 8142d52

Browse files
committed
Require Node.js 18
1 parent 714d602 commit 8142d52

File tree

6 files changed

+31
-26
lines changed

6 files changed

+31
-26
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 16
13+
- 20
14+
- 18
1415
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v2
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
1718
with:
1819
node-version: ${{ matrix.node-version }}
1920
- run: npm install

example.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import phpServer from './index.js';
22

3-
// TODO: Remove the async wrapper when ESLint 8 is out.
4-
(async () => {
5-
const server = await phpServer();
6-
console.log(`PHP server running at ${server.url}`);
7-
})();
3+
const server = await phpServer();
4+
console.log(`PHP server running at ${server.url}`);

index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface Options {
1+
export type Options = {
22
/**
33
The port on which you want to access the webserver.
44
@@ -76,9 +76,9 @@ export interface Options {
7676
Add custom [INI directives](https://php.net/manual/en/ini.list.php).
7777
*/
7878
readonly directives?: Record<string, string>;
79-
}
79+
};
8080

81-
export interface Server {
81+
export type Server = {
8282
/**
8383
The [`subprocess.stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout).
8484
*/
@@ -98,7 +98,7 @@ export interface Server {
9898
A method, which when called, stops the server.
9999
*/
100100
stop(): void;
101-
}
101+
};
102102

103103
/**
104104
Start a [PHP server](https://php.net/manual/en/features.commandline.webserver.php)

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'node:path';
33
import {spawn} from 'node:child_process';
44
import http from 'node:http';
55
import open from 'open';
6-
import binVersionCheck from 'bin-version-check';
6+
import binaryVersionCheck from 'binary-version-check';
77
import getPort from 'get-port';
88

99
const isServerRunning = (hostname, port, pathname) => new Promise((resolve, reject) => {
@@ -85,7 +85,7 @@ export default async function phpServer(options) {
8585
spawnArguments.push(options.router);
8686
}
8787

88-
await binVersionCheck(options.binary, '>=5.4');
88+
await binaryVersionCheck(options.binary, '>=5.4');
8989

9090
const subprocess = spawn(options.binary, spawnArguments, {
9191
env: {

index.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {expectType} from 'tsd';
2-
import phpServer, {Server} from './index.js';
2+
import phpServer, {type Server} from './index.js';
33

44
expectType<Promise<Server>>(phpServer());
55

package.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
"author": {
99
"name": "Sindre Sorhus",
1010
"email": "sindresorhus@gmail.com",
11-
"url": "http://sindresorhus.com"
11+
"url": "https://sindresorhus.com"
1212
},
1313
"type": "module",
14-
"exports": "./index.js",
14+
"exports": {
15+
"types": "./index.d.ts",
16+
"default": "./index.js"
17+
},
18+
"sideEffects": false,
1519
"engines": {
16-
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
20+
"node": ">=18"
1721
},
1822
"scripts": {
1923
"test": "xo && ava && tsd"
@@ -32,15 +36,18 @@
3236
"development"
3337
],
3438
"dependencies": {
35-
"bin-version-check": "^5.0.0",
36-
"get-port": "^6.0.0",
37-
"open": "^8.2.1"
39+
"binary-version-check": "^6.1.0",
40+
"get-port": "^7.1.0",
41+
"open": "^10.1.0"
3842
},
3943
"devDependencies": {
40-
"@types/node": "^16.10.2",
41-
"ava": "^3.15.0",
42-
"got": "^11.8.2",
43-
"tsd": "^0.17.0",
44-
"xo": "^0.45.0"
44+
"@types/node": "^20.12.3",
45+
"ava": "^6.1.2",
46+
"got": "^14.2.1",
47+
"tsd": "^0.31.0",
48+
"xo": "^0.58.0"
49+
},
50+
"ava": {
51+
"workerThreads": false
4552
}
4653
}

0 commit comments

Comments
 (0)