Skip to content

Commit

Permalink
Require Node.js 14
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 1, 2022
1 parent 7ec84a5 commit 3af5699
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 16
- 14
- 12
- 10
- 8
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
17 changes: 9 additions & 8 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const npmUser = require('npm-user');
import process from 'node:process';
import meow from 'meow';
import npmUser from 'npm-user';

const cli = meow(`
Usage
Expand All @@ -13,7 +13,9 @@ const cli = meow(`
Email: sindresorhus@gmail.com
GitHub: sindresorhus
Twitter: sindresorhus
`);
`, {
importMeta: import.meta,
});

const [username] = cli.input;

Expand All @@ -24,12 +26,11 @@ if (!username) {

(async () => {
const user = await npmUser(username);

const ret = [];
const rows = [];

const createRow = (prefix, key) => {
if (user[key]) {
ret.push(`${prefix}: ${user[key]}`);
rows.push(`${prefix}: ${user[key]}`);
}
};

Expand All @@ -38,5 +39,5 @@ if (!username) {
createRow('GitHub', 'github');
createRow('Twitter', 'twitter');

console.log(ret.join('\n'));
console.log(rows.join('\n'));
})();
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
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
"description": "Get user info of an npm user",
"license": "MIT",
"repository": "sindresorhus/npm-user-cli",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"bin": {
"npm-user": "cli.js"
},
"engines": {
"node": ">=8"
"node": ">=14.16"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -36,12 +38,12 @@
"profile"
],
"dependencies": {
"meow": "^5.0.0",
"npm-user": "^3.0.2"
"meow": "^10.1.2",
"npm-user": "^5.0.0"
},
"devDependencies": {
"ava": "*",
"pify": "^3.0.0",
"xo": "*"
"ava": "^4.2.0",
"execa": "^6.1.0",
"xo": "^0.48.0"
}
}
12 changes: 2 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

> Get user info of an npm user

## Install

```
$ npm install --global npm-user-cli
```sh
npm install --global npm-user-cli
```


## Usage

```
Expand All @@ -26,12 +24,6 @@ $ npm-user --help
Twitter: sindresorhus
```


## Related

- [npm-user](https://github.com/sindresorhus/npm-user) - API for this module


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
7 changes: 3 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import childProcess from 'child_process';
import {execa} from 'execa';
import test from 'ava';
import pify from 'pify';

test('main', async t => {
const stdout = await pify(childProcess.execFile)('./cli.js', ['sindresorhus']);
t.is(stdout.trim().split('\n')[0], 'Name: Sindre Sorhus');
const {stdout} = await execa('./cli.js', ['sindresorhus']);
t.is(stdout.split('\n')[0], 'Name: Sindre Sorhus');
});

0 comments on commit 3af5699

Please sign in to comment.