diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18531b3..441975c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/cli.js b/cli.js index 92ebdcf..2ae853b 100755 --- a/cli.js +++ b/cli.js @@ -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 @@ -16,11 +16,12 @@ 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) { @@ -28,7 +29,7 @@ if (cli.input.length === 0) { 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); diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (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: diff --git a/package.json b/package.json index 704e2ca..aaf97e2 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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" } } diff --git a/readme.md b/readme.md index 0001623..378eff3 100644 --- a/readme.md +++ b/readme.md @@ -2,14 +2,12 @@ > Find a file by walking up parent directories - ## Install ``` $ npm install --global find-up-cli ``` - ## Usage ``` @@ -22,7 +20,6 @@ $ find-up --help --cwd= Working directory ``` - ## Example ``` @@ -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) diff --git a/test.js b/test.js index 2cdc29c..f0a0605 100644 --- a/test.js +++ b/test.js @@ -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);