Skip to content

Commit

Permalink
Require Node.js 14, TS 4.7, and move to ESM (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 11, 2022
1 parent c408f5a commit d6fc1ce
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 316 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 16
- 14
- 12
- 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
62 changes: 24 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"main": "dist/index.js",
"type": "module",
"exports": "./index.js",
"types": "./index.d.ts",
"engines": {
"node": ">=10"
"node": ">=14.16"
},
"scripts": {
"build": "del dist && tsc",
Expand Down Expand Up @@ -47,50 +49,34 @@
"types"
],
"devDependencies": {
"@sindresorhus/tsconfig": "^0.7.0",
"@types/jsdom": "^16.1.0",
"@types/node": "^14.0.13",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^2.20.0",
"@typescript-eslint/parser": "^2.20.0",
"ava": "^3.3.0",
"del-cli": "^2.0.0",
"eslint-config-xo-typescript": "^0.26.0",
"jsdom": "^16.0.1",
"rxjs": "^6.4.0",
"tempy": "^0.4.0",
"ts-node": "^8.3.0",
"typescript": "~3.8.2",
"xo": "^0.26.1",
"zen-observable": "^0.8.8"
"@sindresorhus/tsconfig": "^3.0.1",
"@types/jsdom": "^16.2.14",
"@types/node": "^17.0.42",
"@types/zen-observable": "^0.8.3",
"ava": "^4.3.0",
"del-cli": "^4.0.1",
"jsdom": "^19.0.0",
"rxjs": "^7.5.5",
"tempy": "^3.0.0",
"ts-node": "^10.8.1",
"typescript": "~4.7.3",
"xo": "^0.50.0",
"zen-observable": "^0.8.15"
},
"types": "dist/index.d.ts",
"sideEffects": false,
"ava": {
"extensions": [
"ts"
],
"require": [
"ts-node/register"
"extensions": {
"ts": "module"
},
"nodeArguments": [
"--loader=ts-node/esm"
]
},
"xo": {
"extends": "xo-typescript",
"extensions": [
"ts"
],
"parserOptions": {
"project": "./tsconfig.xo.json"
},
"globals": [
"BigInt",
"BigInt64Array",
"BigUint64Array"
],
"rules": {
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-function-return-type": "off"
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/triple-slash-reference": "off"
}
}
}
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npm install @sindresorhus/is
## Usage

```js
const is = require('@sindresorhus/is');
import is from '@sindresorhus/is';

is('🦄');
//=> 'string'
Expand All @@ -39,7 +39,7 @@ is.number(6);
[Assertions](#type-assertions) perform the same type checks, but throw an error if the type does not match.

```js
const {assert} = require('@sindresorhus/is');
import {assert} from '@sindresorhus/is';

assert.string(2);
//=> Error: Expected value which is `string`, received value of type `number`.
Expand Down Expand Up @@ -436,7 +436,7 @@ Returns `true` if `value` is a DOM Element.
Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html).

```js
const fs = require('fs');
import fs from 'node:fs';

is.nodeStream(fs.createReadStream('unicorn.png'));
//=> true
Expand All @@ -447,7 +447,7 @@ is.nodeStream(fs.createReadStream('unicorn.png'));
Returns `true` if `value` is an `Observable`.

```js
const {Observable} = require('rxjs');
import {Observable} from 'rxjs';

is.observable(new Observable());
//=> true
Expand Down
Loading

0 comments on commit d6fc1ce

Please sign in to comment.