diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-02-22 07:27:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 15:27:03 +0800 |
commit | 960668ccdb8a3498ee61387648c457f242cfe29c (patch) | |
tree | 0f8c5113b625037911e6e16a0764c9f3debf9c2c | |
parent | 55b59407e44bcccf0068d6ae2dc3f446d60809b4 (diff) | |
download | tracifyjs-960668ccdb8a3498ee61387648c457f242cfe29c.tar.gz tracifyjs-960668ccdb8a3498ee61387648c457f242cfe29c.zip |
improve CLI usability (#4670)
closes #3308
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | bin/uglifyjs | 7 |
2 files changed, 11 insertions, 7 deletions
@@ -4,12 +4,11 @@ UglifyJS 3 UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. #### Note: -- **`uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage) - that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x)**. -- **Documentation for UglifyJS `2.x` releases can be found [here](https://github.com/mishoo/UglifyJS/tree/v2.x)**. -- `uglify-js` supports ECMAScript 5 and some newer language features. -- To minify ECMAScript 2015 or above, you may need to transpile using tools like - [Babel](https://babeljs.io/). +- `uglify-js` supports JavaScript and most language features in ECMAScript. +- For more exotic parts of ECMAScript, process your source file with transpilers + like [Babel](https://babeljs.io/) before passing onto `uglify-js`. +- `uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage) + that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x). Install ------- diff --git a/bin/uglifyjs b/bin/uglifyjs index 60335426..35f06412 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -260,9 +260,14 @@ if (paths.length) { }); run(); } else { + var timerId = process.stdin.isTTY && process.argv.length < 3 && setTimeout(function() { + print_error("Waiting for input... (use `--help` to print usage information)"); + }, 1500); var chunks = []; process.stdin.setEncoding("utf8"); - process.stdin.on("data", function(chunk) { + process.stdin.once("data", function() { + clearTimeout(timerId); + }).on("data", function(chunk) { chunks.push(chunk); }).on("end", function() { files = { STDIN: chunks.join("") }; |