@platform/react.ssr
Version:
A lightweight SSR (server-side-rendering) system for react apps bundled with ParcelJS and hosted on S3.
20 lines (19 loc) • 819 B
JavaScript
import { fs, log, util } from '../common';
export async function bundle(args) {
const { bundleDir, manifest } = args;
const dirSize = await fs.size.dir(bundleDir);
log.info();
log.info.gray(` size: ${log.magenta(dirSize.toString())}`);
log.info.gray(` dir: ${util.formatPath(bundleDir)}`);
log.info();
manifest.files.forEach(file => {
let path = file.path;
path = path.endsWith('.js') ? log.yellow(path) : path;
path = path.endsWith('.html') ? log.green(path) : path;
const fileSize = dirSize.files.find(item => item.path.endsWith(`/${file}`));
let size = fileSize ? fileSize.toString({ round: 0, spacer: '' }) : '';
size = `${size} `.substring(0, 8);
log.info.gray(` - ${size} ${path}`);
});
log.info();
}