From 3da6a8412cd7644d4a0d987f6c07a47ee5422448 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Sat, 2 Sep 2017 23:04:34 -0400 Subject: [PATCH 1/6] prettier_dnc: Read ~/.prettier_d only once --- bin/prettier_dnc.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/prettier_dnc.sh b/bin/prettier_dnc.sh index 54176da4e..973ba8278 100755 --- a/bin/prettier_dnc.sh +++ b/bin/prettier_dnc.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -PORT=`cat ~/.prettier_d | cut -d" " -f1` -TOKEN=`cat ~/.prettier_d | cut -d" " -f2` + +IFS=' ' read PORT TOKEN < ~/.prettier_d + if nc 2>&1 | grep -- -q >/dev/null; then cat <(echo "$TOKEN $PWD --stdin $@") - | nc -q 0 localhost $PORT else From 6e5689bc04b10b38243ee4975cdb742b49d07f98 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Sat, 2 Sep 2017 23:10:29 -0400 Subject: [PATCH 2/6] prettier_dnc: Dedupe netcat code --- bin/prettier_dnc.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/prettier_dnc.sh b/bin/prettier_dnc.sh index 973ba8278..d5c66d049 100755 --- a/bin/prettier_dnc.sh +++ b/bin/prettier_dnc.sh @@ -3,7 +3,9 @@ IFS=' ' read PORT TOKEN < ~/.prettier_d if nc 2>&1 | grep -- -q >/dev/null; then - cat <(echo "$TOKEN $PWD --stdin $@") - | nc -q 0 localhost $PORT + NC_OPTIONS="-q 0" else - cat <(echo "$TOKEN $PWD --stdin $@") - | nc localhost $PORT + NC_OPTIONS="" fi + +cat <(echo "$TOKEN $PWD --stdin $@") - | nc $NC_OPTIONS localhost $PORT From 7d98373e17e014ee254b9e6b80dfc5e0a3542df1 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Thu, 5 Oct 2017 11:53:34 -0400 Subject: [PATCH 3/6] Upgrade dependencies This was done with `yarn upgrade-interactive` --- lib/options.js | 2 +- test.sh | 2 +- yarn.lock | 52 ++++++++++++++++++++++++++++---------------------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/lib/options.js b/lib/options.js index 3b7fc66b9..e97b73b73 100644 --- a/lib/options.js +++ b/lib/options.js @@ -12,7 +12,7 @@ module.exports.generateHelp = function() { prettierPath, '--help', '| sed "s/Usage: prettier/Usage: prettier_d/"', - '| sed "s/filename .../filename/"', + '| sed "s/file\\/glob .../filename/"', '| grep -v -- --color', ].join(' ') const prettierHelp = cp.execSync(prettierHelpCommand).toString() diff --git a/test.sh b/test.sh index ee3869e6c..04ab8d4fb 100755 --- a/test.sh +++ b/test.sh @@ -29,7 +29,7 @@ tmp=.write.test.js cp $file $tmp && $prettier --write $tmp && $prettier --list-different $tmp | wc -c | grep '\<0$' >/dev/null && rm $tmp # Ensure help message shows prettier_d and only one filename -$prettier --help | grep "Usage: prettier_d .opts. .filename.$" >/dev/null +$prettier --help | grep "Usage: prettier_d .options. .filename.$" >/dev/null # Ensure --fallback is in the help message $prettier --help | grep -- "--fallback" >/dev/null diff --git a/yarn.lock b/yarn.lock index 8e9cbde1e..51df3b0e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -216,9 +216,9 @@ cross-spawn@^5.1.0: shebang-command "^1.2.0" which "^1.2.9" -debug@^2.6.8: - version "2.6.8" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" +debug@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" @@ -264,11 +264,11 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" eslint-plugin-prettier@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.2.0.tgz#f2837ad063903d73c621e7188fb3d41486434088" + version "2.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.3.1.tgz#e7a746c67e716f335274b88295a9ead9f544e44d" dependencies: fast-diff "^1.1.1" - jest-docblock "^20.0.1" + jest-docblock "^21.0.0" eslint-scope@^3.7.1: version "3.7.1" @@ -278,18 +278,18 @@ eslint-scope@^3.7.1: estraverse "^4.1.1" eslint@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.5.0.tgz#bb75d3b8bde97fb5e13efcd539744677feb019c3" + version "4.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.8.0.tgz#229ef0e354e0e61d837c7a80fdfba825e199815e" dependencies: ajv "^5.2.0" babel-code-frame "^6.22.0" chalk "^2.1.0" concat-stream "^1.6.0" cross-spawn "^5.1.0" - debug "^2.6.8" + debug "^3.0.1" doctrine "^2.0.0" eslint-scope "^3.7.1" - espree "^3.5.0" + espree "^3.5.1" esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" @@ -310,7 +310,7 @@ eslint@^4.5.0: natural-compare "^1.4.0" optionator "^0.8.2" path-is-inside "^1.0.2" - pluralize "^4.0.0" + pluralize "^7.0.0" progress "^2.0.0" require-uncached "^1.0.3" semver "^5.3.0" @@ -319,9 +319,9 @@ eslint@^4.5.0: table "^4.0.1" text-table "~0.2.0" -espree@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.0.tgz#98358625bdd055861ea27e2867ea729faf463d8d" +espree@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.1.tgz#0c988b8ab46db53100a1954ae4ba995ddd27d87e" dependencies: acorn "^5.1.1" acorn-jsx "^3.0.0" @@ -533,9 +533,9 @@ isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" -jest-docblock@^20.0.1: - version "20.0.3" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" js-tokens@^3.0.2: version "3.0.2" @@ -693,17 +693,17 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pluralize@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" prettier@^1.5.3: - version "1.5.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.5.3.tgz#59dadc683345ec6b88f88b94ed4ae7e1da394bfe" + version "1.7.4" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.4.tgz#5e8624ae9363c80f95ec644584ecdf55d74f93fa" process-nextick-args@~1.0.6: version "1.0.7" @@ -853,12 +853,18 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^4.0.0, supports-color@^4.2.1: +supports-color@^4.0.0: version "4.2.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" dependencies: has-flag "^2.0.0" +supports-color@^4.2.1: + version "4.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" + dependencies: + has-flag "^2.0.0" + table@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/table/-/table-4.0.1.tgz#a8116c133fac2c61f4a420ab6cdf5c4d61f0e435" From 47ef7cd9d346fb7e4d120228ae7e001cc86589b5 Mon Sep 17 00:00:00 2001 From: Nicolas Schmitt Date: Mon, 8 Jan 2018 13:59:20 +0100 Subject: [PATCH 4/6] connect to 127.0.0.1 instead of localhost --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index c703639e5..23be4db86 100644 --- a/lib/client.js +++ b/lib/client.js @@ -10,7 +10,7 @@ function connect(callback) { return callback(Error('Not running')) } net - .connect(data.port, function() { + .connect(data.port, '127.0.0.1', function() { callback(null, this, data.token) }) .on('error', () => { From 388366fdd03e84aebbc2ca0289661c4defbe2625 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Mon, 8 Jan 2018 08:42:30 -0500 Subject: [PATCH 5/6] Use 127.0.0.1 instead of localhost in prettier_dnc and README --- README.md | 4 ++-- bin/prettier_dnc.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dcd7b727f..6c93e734f 100644 --- a/README.md +++ b/README.md @@ -228,10 +228,10 @@ time. ```bash PORT=`cat ~/.prettier_d | cut -d" " -f1` TOKEN=`cat ~/.prettier_d | cut -d" " -f2` -echo "$TOKEN $PWD file.js" | nc -q 0 localhost $PORT +echo "$TOKEN $PWD file.js" | nc -q 0 127.0.0.1 $PORT # You can also pipe a stream in with `--stdin`: -cat file.js | cat <(echo "$TOKEN $PWD --stdin") - | nc -q 0 localhost $PORT +cat file.js | cat <(echo "$TOKEN $PWD --stdin") - | nc -q 0 127.0.0.1 $PORT # `prettier_dnc` is provided as a helper script for this usage: cat file.js | prettier_dnc ``` diff --git a/bin/prettier_dnc.sh b/bin/prettier_dnc.sh index d5c66d049..aa9f57538 100755 --- a/bin/prettier_dnc.sh +++ b/bin/prettier_dnc.sh @@ -8,4 +8,4 @@ else NC_OPTIONS="" fi -cat <(echo "$TOKEN $PWD --stdin $@") - | nc $NC_OPTIONS localhost $PORT +cat <(echo "$TOKEN $PWD --stdin $@") - | nc $NC_OPTIONS 127.0.0.1 $PORT From 3306451ff789146243de7365d55418b253fa0c87 Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Mon, 8 Jan 2018 11:53:52 -0500 Subject: [PATCH 6/6] 5.7.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f905ac5c4..e44683dee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prettier_d", - "version": "5.7.3", + "version": "5.7.4", "description": "Makes prettier the fastest formatter on the planet", "bin": { "prettier_d": "bin/prettier_d.js",