Skip to content

Commit

Permalink
Require Node.js 12.20
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 16, 2021
1 parent 3ace125 commit b1b4805
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 42 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ jobs:
fail-fast: false
matrix:
node-version:
- 14
- 12
- 10
- 8
- 6
- 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
30 changes: 17 additions & 13 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const internalIp = require('internal-ip');
import meow from 'meow';
import {internalIpV6Sync, internalIpV4Sync} from 'internal-ip';

const cli = meow(`
Usage
Expand All @@ -17,15 +16,20 @@ const cli = meow(`
$ internal-ip --ipv4
10.0.0.79
`, {
boolean: [
'ipv6',
'ipv4'
],
alias: {
6: 'ipv6',
4: 'ipv4'
}
importMeta: import.meta,
flags: {
ipv6: {
type: 'boolean',
default: true,
alias: '6',
},
ipv4: {
type: 'boolean',
alias: '4',
},
},
});

const fn = cli.flags.ipv4 ? 'v4' : 'v6';
internalIp[fn]().then(console.log);
const getIp = cli.flags.ipv4 ? internalIpV4Sync : internalIpV6Sync;

console.log(getIp());
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
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
"description": "Get your internal IP address",
"license": "MIT",
"repository": "sindresorhus/internal-ip-cli",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"bin": {
"internal-ip": "cli.js"
"internal-ip": "./cli.js"
},
"engines": {
"node": ">=6"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -36,12 +38,12 @@
"gateway"
],
"dependencies": {
"internal-ip": "^2.0.0",
"meow": "^3.7.0"
"internal-ip": "^7.0.0",
"meow": "^10.1.1"
},
"devDependencies": {
"ava": "*",
"execa": "^0.7.0",
"xo": "*"
"ava": "^3.15.0",
"execa": "^5.1.1",
"xo": "^0.45.0"
}
}
14 changes: 3 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

> Get your internal IP address

## Install

```
$ npm install --global internal-ip-cli
```sh
npm install --global internal-ip-cli
```


## Usage

```
Expand All @@ -29,13 +27,7 @@ $ internal-ip --help
10.0.0.79
```


## Related

- [internal-ip](https://github.com/sindresorhus/internal-ip) - API for this module
- [internal-ip](https://github.com/sindresorhus/internal-ip) - API for this package
- [public-ip-cli](https://github.com/sindresorhus/public-ip-cli) - Get your public IP address


## 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,4 +1,4 @@
import {isIPv4, isIPv6} from 'net';
import {isIPv4, isIPv6} from 'node:net';
import test from 'ava';
import execa from 'execa';

Expand Down

0 comments on commit b1b4805

Please sign in to comment.