@vanillaes/esmtk 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/commands/preview.js +9 -2
- package/package.json +1 -1
package/bin/commands/preview.js
CHANGED
|
@@ -73,6 +73,14 @@ function fileCompare (a, b) {
|
|
|
73
73
|
*/
|
|
74
74
|
function formatFile (path) {
|
|
75
75
|
const size = statSync(path).size
|
|
76
|
+
if (size > (1024 * 1024)) {
|
|
77
|
+
const megabytes = (size / (1024 * 1024)).toLocaleString('en-US', {
|
|
78
|
+
minimumFractionDigits: 1,
|
|
79
|
+
maximumFractionDigits: 1,
|
|
80
|
+
roundingMode: 'trunc'
|
|
81
|
+
})
|
|
82
|
+
return `${megabytes} MB`.padEnd(10) + `${path}`
|
|
83
|
+
}
|
|
76
84
|
if (size > 1024) {
|
|
77
85
|
const kilobytes = (size / 1024).toLocaleString('en-US', {
|
|
78
86
|
minimumFractionDigits: 1,
|
|
@@ -80,7 +88,6 @@ function formatFile (path) {
|
|
|
80
88
|
roundingMode: 'trunc'
|
|
81
89
|
})
|
|
82
90
|
return `${kilobytes} KB`.padEnd(10) + `${path}`
|
|
83
|
-
} else {
|
|
84
|
-
return `${size} B`.padEnd(10) + `${path}`
|
|
85
91
|
}
|
|
92
|
+
return `${size} B`.padEnd(10) + `${path}`
|
|
86
93
|
}
|