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 72911ba commit c16a4d7
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 42 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ jobs:
fail-fast: false
matrix:
node-version:
- 14
- 12
- 10
- 8
- 20
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ List of words for making random mnemonic sentences.
@example
```
import mnemonicWords = require('mnemonic-words');
import mnemonicWords from 'mnemonic-words';
console.log(mnemonicWords);
//=> ['abandon', 'ability', …]
```
*/
declare const mnemonicWords: readonly string[];

export = mnemonicWords;
export default mnemonicWords;
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';

// Original source: https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
module.exports = require('./words.json');
import mnemonicWords from './mnemonic-words.json' with {type: 'json'};

export default mnemonicWords;
6 changes: 0 additions & 6 deletions index.test-d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
File renamed without changes.
23 changes: 15 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@
"description": "List of words for making random mnemonic sentences",
"license": "MIT",
"repository": "sindresorhus/mnemonic-words",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=8"
"node": ">=18.20"
},
"scripts": {
"test": "xo && ava && tsd"
"//test": "xo && ava && tsc --noEmit index.d.ts",
"test": "ava && tsc --noEmit index.d.ts"
},
"files": [
"index.js",
"index.d.ts",
"words.json",
"words.json.d.ts"
"mnemonic-words.json"
],
"keywords": [
"mnemonic",
Expand All @@ -33,8 +40,8 @@
"bitcoin"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^6.1.2",
"typescript": "^5.4.5",
"xo": "^0.58.0"
}
}
16 changes: 4 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,25 @@
It could be used for [generating deterministic keys](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).

The word list is just a [JSON file](words.json) and can be used anywhere.

The word list is just a [JSON file](mnemonic-words.json) and can be used anywhere.

## Install

```
$ npm install mnemonic-words
```sh
npm install mnemonic-words
```


## Usage

```js
const mnemonicWords = require('mnemonic-words');
import mnemonicWords from 'mnemonic-words';

console.log(mnemonicWords);
//=> ['abandon', 'ability', …]
```


## Related

- [superb](https://github.com/sindresorhus/superb) - Get superb like words
- [pokemon](https://github.com/sindresorhus/pokemon) - Get Pokémon names
- [cat-names](https://github.com/sindresorhus/cat-names) - Get popular cat names


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
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 mnemonicWords from '.';
import mnemonicWords from './index.js';

test('main', t => {
t.true(Array.isArray(mnemonicWords));
Expand Down
3 changes: 0 additions & 3 deletions words.json.d.ts

This file was deleted.

0 comments on commit c16a4d7

Please sign in to comment.