Comparing version 2.0.0 to 2.1.0
@@ -20,10 +20,10 @@ #!/usr/bin/env node | ||
console.error('') | ||
console.error('Usage: pkgfiles [--sort=size|name|pkgfiles] [--json] [dir]') | ||
console.error('Usage: pkgfiles [--sort=size|name|pkgfiles] [--disk] [--json] [dir]') | ||
console.error('') | ||
console.error(' pkgfiles # List all files which would be published in current directory.') | ||
console.error(' pkgfiles ./mypkg # List all files which would be published in `./mypkg`.') | ||
console.error(' pkgfiles --json # Render JSON output') | ||
console.error(' pkgfiles --sort=size # Sort files by size [default]') | ||
console.error(' pkgfiles --sort=name # Sort files by name') | ||
console.error(' pkgfiles --sort=diskSize # Sort files by size on disk') | ||
console.error(' pkgfiles # List all files which would be published in current directory.') | ||
console.error(' pkgfiles ./mypkg # List all files which would be published in `./mypkg`.') | ||
console.error(' pkgfiles --json # Render JSON output') | ||
console.error(' pkgfiles --sort=size # Sort files by size [default]') | ||
console.error(' pkgfiles --sort=name # Sort files by name') | ||
console.error(' pkgfiles --disk # Include disk sizes in result') | ||
console.error('') | ||
@@ -33,2 +33,3 @@ } | ||
argv.sort = argv.sort || 'size' | ||
if (argv.sort === 'name') argv.sort = 'file' | ||
@@ -88,4 +89,14 @@ pkgFiles.summary(dir, function(err, result) { | ||
}) | ||
.sort(sortBy(argv.sort)) | ||
console.info(columnify(result.entries, {columnSplitter: ' ', columns: ['file', 'size', 'percent', 'diskSize', 'percentDisk'], headingTransform: function(header) { | ||
var columns = ['file', 'size', 'percent',] | ||
if (argv.disk) { | ||
columns.push('diskSize', 'percentDisk') | ||
} else { | ||
summary = summary.filter(function(item) { | ||
return !(/Disk/.test(item.key)) | ||
}) | ||
} | ||
console.info(columnify(result.entries, {columnSplitter: ' ', columns: columns, headingTransform: function(header) { | ||
if (header === 'percent') return '%' | ||
@@ -115,3 +126,3 @@ if (header === 'diskSize') return 'DISK SIZE' | ||
return function(a, b) { | ||
if (typeof a[key] === 'String') { | ||
if (typeof a[key] === 'string') { | ||
return a[key].localeCompare(b[key]) | ||
@@ -118,0 +129,0 @@ } else { |
{ | ||
"name": "pkgfiles", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "List all files which would be published in a package.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,2 +23,24 @@ # pkgfiles | ||
FILE SIZE % | ||
test/pkg/lib/index.js 0 B 0% | ||
test/pkg/index.js 0 B 0% | ||
.npmignore N/A | ||
.travis.yml 84 B 1% | ||
test/pkg/package.json 269 B 2% | ||
test/index.js 739 B 6% | ||
package.json 900 B 7% | ||
LICENSE 1.08 kB 9% | ||
index.js 2.99 kB 24% | ||
Readme.md 3.12 kB 25% | ||
bin/pkgfiles.js 3.43 kB 27% | ||
PKGFILES SUMMARY | ||
Size with Dependencies ~885.15 kB | ||
Publishable Size ~12.61 kB | ||
Number of Files 11 | ||
``` | ||
``` | ||
> pkgfiles --disk | ||
FILE SIZE % DISK SIZE DISK SIZE % | ||
@@ -43,5 +65,26 @@ test/pkg/lib/index.js 0 B 0% 0 B 0% | ||
Number of Files 11 | ||
> | ||
``` | ||
``` | ||
> pkgfiles --sort=name | ||
FILE SIZE % | ||
.npmignore N/A | ||
.travis.yml 84 B 1% | ||
LICENSE 1.08 kB 8% | ||
Readme.md 4.24 kB 31% | ||
bin/pkgfiles.js 3.5 kB 25% | ||
index.js 2.99 kB 22% | ||
package.json 900 B 7% | ||
test/index.js 739 B 5% | ||
test/pkg/index.js 0 B 0% | ||
test/pkg/lib/index.js 0 B 0% | ||
test/pkg/package.json 269 B 2% | ||
PKGFILES SUMMARY | ||
Size with Dependencies ~886.34 kB | ||
Publishable Size ~13.8 kB | ||
Number of Files 11 | ||
``` | ||
## API | ||
@@ -48,0 +91,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
13813
242
144