Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Fixes #21
  • Loading branch information
sindresorhus committed Oct 5, 2022
1 parent 6347a48 commit e50d0f3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 18
- 16
- 14
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
37 changes: 18 additions & 19 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env node
import process from 'node:process';
import meow from 'meow';
import open from 'open';
import getStdin from 'get-stdin';
import tempy from 'tempy';
import FileType from 'file-type';
import {temporaryWrite} from 'tempy';
import {fileTypeFromBuffer} from 'file-type';

const cli = meow(`
Usage
Expand All @@ -27,16 +28,16 @@ const cli = meow(`
flags: {
wait: {
type: 'boolean',
default: false
default: false,
},
background: {
type: 'boolean',
default: false
default: false,
},
extension: {
type: 'string'
}
}
type: 'string',
},
},
});

const input = cli.input[0];
Expand All @@ -51,18 +52,16 @@ const [, appName, ...appArguments] = cli.input;
if (appName) {
options.app = {
name: appName,
arguments: appArguments
arguments: appArguments,
};
}

(async () => {
if (input) {
await open(input, options);
} else {
const stdin = await getStdin.buffer();
const type = await FileType.fromBuffer(stdin);
const extension = cli.flags.extension ?? type?.ext ?? 'txt';
const filePath = await tempy.write(stdin, {extension});
await open(filePath, options);
}
})();
if (input) {
await open(input, options);
} else {
const stdin = await getStdin.buffer();
const type = await fileTypeFromBuffer(stdin);
const extension = cli.flags.extension ?? type?.ext ?? 'txt';
const filePath = await temporaryWrite(stdin, {extension});
await open(filePath, options);
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"open-cli": "cli.js"
},
"engines": {
"node": ">=14.13"
"node": ">=14.16"
},
"scripts": {
"test": "xo && ava"
Expand Down Expand Up @@ -51,15 +51,15 @@
"file"
],
"dependencies": {
"file-type": "^16.5.0",
"file-type": "^18.0.0",
"get-stdin": "^9.0.0",
"meow": "^10.0.1",
"open": "^8.2.0",
"tempy": "^1.0.1"
"meow": "^10.1.5",
"open": "^8.4.0",
"tempy": "^3.0.0"
},
"devDependencies": {
"ava": "^3.15.0",
"execa": "^5.1.1",
"xo": "^0.40.2"
"ava": "^4.3.3",
"execa": "^6.1.0",
"xo": "^0.52.4"
}
}
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
## Install

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

## Usage
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import execa from 'execa';
import {execa} from 'execa';

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

0 comments on commit e50d0f3

Please sign in to comment.