Skip to content

Commit

Permalink
Require Node.js 12 and move to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 18, 2021
1 parent 73d12af commit 30ba81f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ jobs:
node-version:
- 14
- 12
- 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
6 changes: 2 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ Detect whether the terminal supports Unicode.
@example
```
import isUnicodeSupported = require('is-unicode-supported');
import isUnicodeSupported from 'is-unicode-supported';
isUnicodeSupported();
//=> true
```
*/
declare function isUnicodeSupported(): boolean;

export = isUnicodeSupported;
export default function isUnicodeSupported(): boolean;
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
'use strict';

module.exports = () => {
export default function isUnicodeSupported() {
if (process.platform !== 'win32') {
return true;
}
Expand All @@ -10,4 +8,4 @@ module.exports = () => {
process.env.TERM_PROGRAM === 'vscode' ||
process.env.TERM === 'xterm-256color' ||
process.env.TERM === 'alacritty';
};
}
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expectType} from 'tsd';
import isUnicodeSupported = require('.');
import isUnicodeSupported from './index.js';

expectType<boolean>(isUnicodeSupported());
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=10"
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
Expand All @@ -34,7 +36,7 @@
"detection"
],
"devDependencies": {
"ava": "^2.4.0",
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install is-unicode-supported
## Usage

```js
const isUnicodeSupported = require('is-unicode-supported');
import isUnicodeSupported from 'is-unicode-supported';

isUnicodeSupported();
//=> true
Expand Down

0 comments on commit 30ba81f

Please sign in to comment.