Skip to content

Commit 8968c9b

Browse files
committed
Require Node.js 12.20 and move to ESM
Fixes #14
1 parent c757835 commit 8968c9b

File tree

8 files changed

+22
-29
lines changed

8 files changed

+22
-29
lines changed

.github/funding.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 14
14-
- 12
15-
- 10
13+
- 16
1614
steps:
1715
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
16+
- uses: actions/setup-node@v2
1917
with:
2018
node-version: ${{ matrix.node-version }}
2119
- run: npm install

index.d.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/**
22
Fix the `$PATH` on macOS when run from a GUI app.
33
4-
Useful for Electron apps as GUI apps on macOS doesn't inherit the `$PATH` defined in your dotfiles *(.bashrc/.bash_profile/.zshrc/etc)*.
5-
64
```
7-
import fixPath = require('fix-path');
5+
import fixPath from 'fix-path';
86
97
console.log(process.env.PATH);
108
//=> '/usr/bin'
@@ -15,6 +13,4 @@ console.log(process.env.PATH);
1513
//=> '/usr/local/bin:/usr/bin'
1614
```
1715
*/
18-
declare function fixPath(): void;
19-
20-
export = fixPath;
16+
export default function fixPath(): void;

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
'use strict';
2-
const shellPath = require('shell-path');
1+
import process from 'node:process';
2+
import {shellPathSync} from 'shell-path';
33

4-
module.exports = () => {
4+
export default function fixPath() {
55
if (process.platform !== 'darwin') {
66
return;
77
}
88

9-
process.env.PATH = shellPath.sync() || [
9+
process.env.PATH = shellPathSync() || [
1010
'./node_modules/.bin',
1111
'/.nodebrew/current/bin',
1212
'/usr/local/bin',
13-
process.env.PATH
13+
process.env.PATH,
1414
].join(':');
15-
};
15+
}

index.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import {expectType} from 'tsd';
2-
import fixPath = require('.');
2+
import fixPath from './index.js';
33

44
expectType<void>(fixPath());

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
"email": "sindresorhus@gmail.com",
1111
"url": "https://sindresorhus.com"
1212
},
13+
"type": "module",
14+
"exports": "./index.js",
1315
"engines": {
14-
"node": ">=10"
16+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
1517
},
1618
"scripts": {
1719
"test": "xo && ava && tsd"
@@ -24,7 +26,6 @@
2426
"fix",
2527
"path",
2628
"macos",
27-
"osx",
2829
"env",
2930
"environment",
3031
"variable",
@@ -34,11 +35,11 @@
3435
"electron"
3536
],
3637
"dependencies": {
37-
"shell-path": "^2.1.0"
38+
"shell-path": "^3.0.0"
3839
},
3940
"devDependencies": {
40-
"ava": "^1.4.1",
41-
"tsd": "^0.11.0",
42-
"xo": "^0.26.1"
41+
"ava": "^3.15.0",
42+
"tsd": "^0.17.0",
43+
"xo": "^0.44.0"
4344
}
4445
}

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Fix the `$PATH` on macOS when run from a GUI app
44
5-
Useful for Electron apps as GUI apps on macOS doesn't inherit the `$PATH` defined in your dotfiles *(.bashrc/.bash_profile/.zshrc/etc)*.
5+
Useful for Electron apps as GUI apps on macOS do not inherit the `$PATH` defined in your dotfiles *(.bashrc/.bash_profile/.zshrc/etc)*.
66

77
## Install
88

@@ -13,7 +13,7 @@ $ npm install fix-path
1313
## Usage
1414

1515
```js
16-
const fixPath = require('fix-path');
16+
import fixPath from 'fix-path';
1717

1818
console.log(process.env.PATH);
1919
//=> '/usr/bin'

test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import process from 'node:process';
12
import test from 'ava';
2-
import fixPath from '.';
3+
import fixPath from './index.js';
34

45
test('main', t => {
56
fixPath();

0 commit comments

Comments
 (0)