mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
29 lines
732 B
JavaScript
29 lines
732 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const { execSync } = require('child_process');
|
|
|
|
const PrivTrackerDir = '../priv/tracker/js/';
|
|
|
|
const toReport = [
|
|
'plausible.js',
|
|
'plausible.pageleave.js',
|
|
'plausible.manual.pageleave.js',
|
|
'plausible.hash.pageleave.js'
|
|
];
|
|
|
|
const results = [];
|
|
|
|
toReport.forEach((filename) => {
|
|
const filePath = path.join(PrivTrackerDir, filename);
|
|
if (fs.statSync(filePath).isFile()) {
|
|
results.push({
|
|
'Filename': filename,
|
|
'Real Size (Bytes)': fs.statSync(filePath).size,
|
|
'Gzipped Size (Bytes)': execSync(`gzip -c -9 "${filePath}"`).length,
|
|
'Brotli Size (Bytes)': execSync(`brotli -c -q 11 "${filePath}"`).length
|
|
});
|
|
}
|
|
});
|
|
|
|
console.table(results)
|