Skip to content

Commit

Permalink
Let prettier --stdin work with keyboard input
Browse files Browse the repository at this point in the history
This uses [get-stream] instead of [get-stdin], since the latter just
gives an empty string if process.stdin is a TTY
(see sindresorhus/get-stdin#21)

[get-stream]: https://github.com/sindresorhus/get-stream
[get-stdin]: https://github.com/sindresorhus/get-stdin
  • Loading branch information
josephfrazier committed Jun 14, 2017
1 parent f361910 commit dd4670b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bin/prettier.js
Expand Up @@ -4,7 +4,7 @@

const fs = require("fs");
const path = require("path");
const getStdin = require("get-stdin");
const getStream = require("get-stream");
const glob = require("glob");
const chalk = require("chalk");
const minimist = require("minimist");
Expand Down Expand Up @@ -252,7 +252,7 @@ if (argv["help"] || (!filepatterns.length && !stdin)) {
}

if (stdin) {
getStdin().then(input => {
getStream(process.stdin).then(input => {
try {
writeOutput(format(input, options));
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"eslint-plugin-prettier": "2.1.1",
"esutils": "2.0.2",
"flow-parser": "0.47.0",
"get-stdin": "5.0.1",
"get-stream": "3.0.0",
"glob": "7.1.2",
"graphql": "0.10.1",
"jest": "20.0.0",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -1583,9 +1583,9 @@ get-caller-file@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5"

get-stdin@5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398"
get-stream@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"

getpass@^0.1.1:
version "0.1.7"
Expand Down

0 comments on commit dd4670b

Please sign in to comment.