Skip to content

Commit 87153b5

Browse files
BendingBendersindresorhus
authored andcommitted
Require Node.js 8, add TypeScript definition (#1)
1 parent 4b7d236 commit 87153b5

10 files changed

+70
-60
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
yarn.lock

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: node_js
22
node_js:
3-
- '6'
4-
- '4'
3+
- '10'
4+
- '8'

index.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
Check if the process is running inside [Windows Subsystem for Linux](https://msdn.microsoft.com/commandline/wsl/about) (Bash on Windows).
3+
4+
@example
5+
```
6+
import isWsl = require('is-wsl');
7+
8+
// When running inside Windows Subsystem for Linux
9+
console.log(isWsl);
10+
//=> true
11+
```
12+
*/
13+
declare const isWsl: boolean;
14+
15+
export = isWsl;

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const isWsl = () => {
1313

1414
try {
1515
return fs.readFileSync('/proc/version', 'utf8').includes('Microsoft');
16-
} catch (err) {
16+
} catch (_) {
1717
return false;
1818
}
1919
};

index.test-d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import {expectType} from 'tsd';
2+
import isWsl = require('.');
3+
4+
expectType<boolean>(isWsl);

license

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
The MIT License (MIT)
1+
MIT License
22

33
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
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:
116

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
148

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.json

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
{
2-
"name": "is-wsl",
3-
"version": "1.1.0",
4-
"description": "Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)",
5-
"license": "MIT",
6-
"repository": "sindresorhus/is-wsl",
7-
"author": {
8-
"name": "Sindre Sorhus",
9-
"email": "[email protected]",
10-
"url": "sindresorhus.com"
11-
},
12-
"engines": {
13-
"node": ">=4"
14-
},
15-
"scripts": {
16-
"test": "xo && ava"
17-
},
18-
"files": [
19-
"index.js"
20-
],
21-
"keywords": [
22-
"check",
23-
"wsl",
24-
"windows",
25-
"subsystem",
26-
"linux",
27-
"detect",
28-
"bash",
29-
"process",
30-
"console",
31-
"terminal",
32-
"is"
33-
],
34-
"devDependencies": {
35-
"ava": "*",
36-
"clear-module": "^2.1.0",
37-
"proxyquire": "^1.7.11",
38-
"xo": "*"
39-
}
2+
"name": "is-wsl",
3+
"version": "1.1.0",
4+
"description": "Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)",
5+
"license": "MIT",
6+
"repository": "sindresorhus/is-wsl",
7+
"author": {
8+
"name": "Sindre Sorhus",
9+
"email": "[email protected]",
10+
"url": "sindresorhus.com"
11+
},
12+
"engines": {
13+
"node": ">=8"
14+
},
15+
"scripts": {
16+
"test": "xo && ava && tsd"
17+
},
18+
"files": [
19+
"index.js",
20+
"index.d.ts"
21+
],
22+
"keywords": [
23+
"check",
24+
"wsl",
25+
"windows",
26+
"subsystem",
27+
"linux",
28+
"detect",
29+
"bash",
30+
"process",
31+
"console",
32+
"terminal",
33+
"is"
34+
],
35+
"devDependencies": {
36+
"ava": "^1.4.1",
37+
"clear-module": "^3.2.0",
38+
"proxyquire": "^2.1.0",
39+
"tsd": "^0.7.2",
40+
"xo": "^0.24.0"
41+
}
4042
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Can be useful if you need to work around unimplemented or buggy features in WSL.
88
## Install
99

1010
```
11-
$ npm install --save is-wsl
11+
$ npm install is-wsl
1212
```
1313

1414

0 commit comments

Comments
 (0)