Skip to content

Commit

Permalink
Require Node.js 12.20 and move to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 23, 2021
1 parent fcc926e commit 781185c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ jobs:
fail-fast: false
matrix:
node-version:
- 14
- 12
- 10
- 8
- 16
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,11 +3,9 @@ Gracefully restore the CLI cursor on exit.
@example
```
import restoreCursor = require('restore-cursor');
import restoreCursor from 'restore-cursor';
restoreCursor();
```
*/
declare function restoreCursor(): void;

export = restoreCursor;
export default function restoreCursor(): void;
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';
const onetime = require('onetime');
const signalExit = require('signal-exit');
import process from 'node:process';
import onetime from 'onetime';
import signalExit from 'signal-exit';

module.exports = onetime(() => {
const restoreCursor = onetime(() => {
signalExit(() => {
process.stderr.write('\u001B[?25h');
}, {alwaysLast: true});
});

export default restoreCursor;
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import restoreCursor = require('.');
import restoreCursor from './index.js';

restoreCursor();
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 <[email protected]> (sindresorhus.com)
Copyright (c) Sindre Sorhus <[email protected]> (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
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
"description": "Gracefully restore the CLI cursor on exit",
"license": "MIT",
"repository": "sindresorhus/restore-cursor",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && tsd"
Expand Down
5 changes: 1 addition & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@
Prevent the cursor you've hidden interactively from remaining hidden if the process crashes.


## Install

```
$ npm install restore-cursor
```


## Usage

```js
const restoreCursor = require('restore-cursor');
import restoreCursor from 'restore-cursor';

restoreCursor();
```


---

<div align="center">
Expand Down

0 comments on commit 781185c

Please sign in to comment.