Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fsStatGzip = (file: string) => {
if (fileGzipStats[file]) return fileGzipStats[file]
fileGzipStats[file] = gzipSize.file(file)
return fileGzipStats[file]
}
const fileSizePromises = section.filesToLoad.map( f => gzipSize.file( f ) );
const fileSizes = await Promise.all( fileSizePromises );
(async () => {
metalsmith(path.resolve(__dirname, '../'))
.source('.')
.use(ignore('src/**/*'))
.metadata({
title: 'currency.js',
description: pkg.description,
version: pkg.version,
dist: pkg.browser,
size: prettyBytes(await gzipSize.file(path.resolve(__dirname, '../../', pkg.browser)))
})
.use(markdown({
highlight: hljs
}))
.use(tableOfContents)
.use(hbs)
.use(concatFiles)
.use(layout)
.build(err => {
if(err) {
throw err;
}
});
})();
async function run() {
return gzipSize.file(path.resolve(`./libs/${lib}/dist/main.js`));
}
results.files.map(async (entry) => ({
name: entry.path,
gzipSize: await gzipSize.file(entry.fullPath),
size: entry.stat.size,
})),
);