Comparing version 1.1.6 to 1.2.0
@@ -18,7 +18,6 @@ #!/usr/bin/env node | ||
/* eslint no-console: 0 */ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var concat = require('concat-stream'); | ||
var argv = require('yargs') | ||
@@ -36,3 +35,3 @@ .alias('o', 'output') | ||
if (argv._.length === 0) { | ||
if (process.stdin.isTTY && argv._.length === 0) { | ||
error('You must provide an input file!'); | ||
@@ -53,5 +52,5 @@ process.exit(1); | ||
function convertFile(err, data) { | ||
function minifyText(err, data) { | ||
if (err) { | ||
error('Reading the file failed', err); | ||
error('Something has gone wrong', err); | ||
} | ||
@@ -78,12 +77,23 @@ esmall(data.toString(), handleMinified); | ||
fs.open(resolve(argv._[0]), 'r', function(err, fd) { | ||
if (err) { | ||
if (err.code === 'ENOENT') { | ||
error(`${argv._[0]} does not exist`); | ||
process.exit(1); | ||
} else { | ||
throw err; | ||
if (process.stdin.isTTY) { | ||
fs.open(resolve(argv._[0]), 'r', function(err, fd) { | ||
if (err) { | ||
if (err.code === 'ENOENT') { | ||
error(`${argv._[0]} does not exist`); | ||
process.exit(1); | ||
} else { | ||
throw err; | ||
} | ||
} | ||
} | ||
fs.readFile(fd, convertFile); | ||
}); | ||
fs.readFile(fd, minifyText); | ||
}); | ||
} | ||
else { | ||
process.stdin.pipe(concat((data) => { | ||
minifyText(null, data); | ||
})); | ||
} | ||
{ | ||
"name": "esmall", | ||
"version": "1.1.6", | ||
"version": "1.2.0", | ||
"description": "Pretty Naive", | ||
@@ -17,2 +17,3 @@ "main": "lib/index.js", | ||
"chalk": "^1.1.3", | ||
"concat-stream": "^1.5.2", | ||
"yargs": "^6.5.0" | ||
@@ -19,0 +20,0 @@ }, |
@@ -14,3 +14,4 @@ # esmall | ||
$ esmall input.js // output to stdout | ||
$ esmall input.js -o output.js.min // output to file | ||
$ esmall input.js -o output.min.js // output to file | ||
$ cat path/to/file.js | esmall > this-works.min.js | ||
``` | ||
@@ -36,3 +37,2 @@ | ||
* sync interface for api | ||
* pipe interface for cli | ||
* embed babili | ||
@@ -39,0 +39,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94058
220
3
+ Addedconcat-stream@^1.5.2
+ Addedbuffer-from@1.1.2(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedutil-deprecate@1.0.2(transitive)