improve CLI usability (#4670)

closes #3308
This commit is contained in:
Alex Lam S.L
2021-02-22 07:27:03 +00:00
committed by GitHub
parent 55b59407e4
commit 960668ccdb
2 changed files with 11 additions and 7 deletions

View File

@@ -4,12 +4,11 @@ UglifyJS 3
UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit.
#### Note: #### Note:
- **`uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage) - `uglify-js` supports JavaScript and most language features in ECMAScript.
that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x)**. - For more exotic parts of ECMAScript, process your source file with transpilers
- **Documentation for UglifyJS `2.x` releases can be found [here](https://github.com/mishoo/UglifyJS/tree/v2.x)**. like [Babel](https://babeljs.io/) before passing onto `uglify-js`.
- `uglify-js` supports ECMAScript 5 and some newer language features. - `uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage)
- To minify ECMAScript 2015 or above, you may need to transpile using tools like that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x).
[Babel](https://babeljs.io/).
Install Install
------- -------

View File

@@ -260,9 +260,14 @@ if (paths.length) {
}); });
run(); run();
} else { } 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 = []; var chunks = [];
process.stdin.setEncoding("utf8"); process.stdin.setEncoding("utf8");
process.stdin.on("data", function(chunk) { process.stdin.once("data", function() {
clearTimeout(timerId);
}).on("data", function(chunk) {
chunks.push(chunk); chunks.push(chunk);
}).on("end", function() { }).on("end", function() {
files = { STDIN: chunks.join("") }; files = { STDIN: chunks.join("") };