Skip to content

Commit

Permalink
Require Node.js 18 and move to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 30, 2024
1 parent 430f843 commit 031ac16
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 13 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 14
- 12
- 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
14 changes: 14 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
List of [video file](https://en.wikipedia.org/wiki/Video_file_format) extensions
@example
```
import videoExtensions from 'video-extensions';
console.log(videoExtensions);
//=> […, 'webm', 'wmv']
```
*/
declare const videoExtensions: readonly string[];

export default videoExtensions;
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import videoExtensions from './video-extensions.json' with {type: 'json'};

export default videoExtensions;
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,25 @@
"email": "[email protected]",
"url": "https://sindresorhus.com"
},
"main": "video-extensions.json",
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=0.10.0"
"node": ">=18.20"
},
"scripts": {
"//test": "xo && ava",
"test": "ava"
},
"files": [
"index.js",
"index.d.ts",
"video-extensions.json"
],
"keywords": [
"ext",
"extensions",
"extension",
"file",
Expand All @@ -36,6 +43,7 @@
"mkv"
],
"devDependencies": {
"ava": "^2.4.0"
"ava": "^6.1.2",
"xo": "^0.58.0"
}
}
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

## Install

```
$ npm install video-extensions
```sh
npm install video-extensions
```

## Usage

```js
const videoExtensions = require('video-extensions');
import videoExtensions from 'video-extensions';

console.log(videoExtensions);
//=> […, 'webm', 'wmv']
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import videoExtensions from './video-extensions.json';
import videoExtensions from './index.js';

test('main', t => {
t.true(Array.isArray(videoExtensions));
Expand Down

0 comments on commit 031ac16

Please sign in to comment.