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 Aug 26, 2021
1 parent 476e2d6 commit 2ca7cef
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 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
15 changes: 8 additions & 7 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 findUp = require('find-up');
import process from 'node:process';
import meow from 'meow';
import {findUpSync} from 'find-up';

const cli = meow(`
Usage
Expand All @@ -16,19 +16,20 @@ const cli = meow(`
$ find-up unicorn.png
/Users/sindresorhus/unicorn.png
`, {
importMeta: import.meta,
flags: {
cwd: {
type: 'string'
}
}
type: 'string',
},
},
});

if (cli.input.length === 0) {
console.error('Specify a filename');
process.exit(1);
}

const filePath = findUp.sync(cli.input[0], cli.flags);
const filePath = findUpSync(cli.input[0], cli.flags);

if (filePath) {
console.log(filePath);
Expand Down
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
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": "Find a file by walking up parent directories",
"license": "MIT",
"repository": "sindresorhus/find-up-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": {
"find-up": "cli.js"
"find-up": "./cli.js"
},
"engines": {
"node": ">=8"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"scripts": {
"test": "xo && ava"
Expand Down Expand Up @@ -44,12 +46,12 @@
"path"
],
"dependencies": {
"find-up": "^4.0.0",
"meow": "^5.0.0"
"find-up": "^6.0.0",
"meow": "^10.1.1"
},
"devDependencies": {
"ava": "^1.4.1",
"execa": "^1.0.0",
"xo": "^0.24.0"
"ava": "^3.15.0",
"execa": "^5.1.1",
"xo": "^0.44.0"
}
}
9 changes: 0 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

> Find a file by walking up parent directories

## Install

```
$ npm install --global find-up-cli
```


## Usage

```
Expand All @@ -22,7 +20,6 @@ $ find-up --help
--cwd=<directory> Working directory
```


## Example

```
Expand All @@ -43,13 +40,7 @@ $ find-up unicorn.png
/Users/sindresorhus/unicorn.png
```


## Related

- [find-up](https://github.com/sindresorhus/find-up) - API for this module
- [look-up-cli](https://github.com/lydell/look-up-cli) - Same thing but with file patterns


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {fileURLToPath} from 'node:url';
import test from 'ava';
import execa from 'execa';

const __filename = fileURLToPath(import.meta.url);

test('main', async t => {
const {stdout} = await execa('./cli.js', ['test.js', '--cwd=fixture']);
t.is(stdout, __filename);
Expand Down

0 comments on commit 2ca7cef

Please sign in to comment.