Skip to content

Commit bd35f29

Browse files
committedMay 3, 2021
Require Node.js 12 and move to ESM
1 parent d60b613 commit bd35f29

File tree

8 files changed

+24
-34
lines changed

8 files changed

+24
-34
lines changed
 

‎.github/funding.yml

-3
This file was deleted.

‎.github/workflows/main.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 16
1314
- 14
1415
- 12
15-
- 10
16-
- 8
1716
steps:
1817
- uses: actions/checkout@v2
19-
- uses: actions/setup-node@v1
18+
- uses: actions/setup-node@v2
2019
with:
2120
node-version: ${{ matrix.node-version }}
2221
- run: npm install

‎index.d.ts

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/// <reference types="node"/>
1+
export interface Options {
2+
/**
3+
The stream to check.
24
3-
declare namespace isInteractive {
4-
interface Options {
5-
/**
6-
The stream to check.
7-
8-
@default process.stdout
9-
*/
10-
readonly stream?: NodeJS.WritableStream;
11-
}
5+
@default process.stdout
6+
*/
7+
readonly stream?: NodeJS.WritableStream;
128
}
139

1410
/**
@@ -20,12 +16,10 @@ This can be useful to decide whether to present interactive UI or animations in
2016
2117
@example
2218
```
23-
import isInteractive = require('is-interactive');
19+
import isInteractive from 'is-interactive';
2420
2521
isInteractive();
2622
//=> true
2723
```
2824
*/
29-
declare function isInteractive(options?: isInteractive.Options): boolean;
30-
31-
export = isInteractive;
25+
export default function isInteractive(options?: Options): boolean;

‎index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
'use strict';
2-
3-
module.exports = ({stream = process.stdout} = {}) => {
1+
export default function isInteractive({stream = process.stdout} = {}) {
42
return Boolean(
53
stream && stream.isTTY &&
64
process.env.TERM !== 'dumb' &&
75
!('CI' in process.env)
86
);
9-
};
7+
}

‎index.test-d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {expectType} from 'tsd';
2-
import isInteractive = require('.');
2+
import isInteractive from './index.js';
33

44
expectType<boolean>(isInteractive({
55
stream: process.stderr

‎package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"email": "sindresorhus@gmail.com",
1111
"url": "https://sindresorhus.com"
1212
},
13+
"type": "module",
14+
"exports": "./index.js",
1315
"engines": {
14-
"node": ">=8"
16+
"node": ">=12"
1517
},
1618
"scripts": {
1719
"test": "xo && ava && tsd"
@@ -31,9 +33,9 @@
3133
"tty"
3234
],
3335
"devDependencies": {
34-
"@types/node": "^12.0.12",
35-
"ava": "^2.1.0",
36-
"tsd": "^0.7.3",
37-
"xo": "^0.24.0"
36+
"@types/node": "^15.0.1",
37+
"ava": "^3.15.0",
38+
"tsd": "^0.14.0",
39+
"xo": "^0.39.1"
3840
}
3941
}

‎readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ npm install is-interactive
1515
## Usage
1616

1717
```js
18-
const isInteractive = require('is-interactive');
18+
import isInteractive from 'is-interactive';
1919

2020
isInteractive();
2121
//=> true
@@ -31,7 +31,7 @@ Type: `object`
3131

3232
##### stream
3333

34-
Type: [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable)<br>
34+
Type: [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable)\
3535
Default: [`process.stdout`](https://nodejs.org/api/process.html#process_process_stdout)
3636

3737
The stream to check.

‎test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {PassThrough as PassThroughStream} from 'stream';
1+
import {PassThrough as PassThroughStream} from 'node:stream';
22
import test from 'ava';
3-
import isInteractive from '.';
3+
import isInteractive from './index.js';
44

55
test('tty', t => {
66
const ci = process.env.CI;

0 commit comments

Comments
 (0)