element-plus/build/size-reporter.ts
三咲智子 55348b30b6
style: use prettier (#3228)
* style: use prettier

* style: just prettier format, no code changes

* style: eslint fix
object-shorthand, prefer-const

* style: fix no-void

* style: no-console
2021-09-04 19:29:28 +08:00

69 lines
2.1 KiB
TypeScript

import chalk from 'chalk'
export default async function reporter(opt, outputOptions, info) {
const values = [
// ...(outputOptions.file || outputOptions.dest
// ? [
// `${title('Destination: ')}${value(
// outputOptions.file || outputOptions.dest,
// )}`,
// ]
// :
info.fileName ? [`${outputOptions.file.split('packages/').pop()}`] : [],
// )
// ...(info.bundleSizeBefore
// ? [
// `${value(info.bundleSize)} (was ${value(
// info.bundleSizeBefore,
// )}${info.lastVersion
// ? ` in version ${info.lastVersion}`
// : ' in last build'
// })`,
// ]
// :
[`${info.bundleSize}`],
// ),
...(info.minSize
? // info.minSizeBefore
// ? [
// `${title('Minified Size: ')} ${value(info.minSize)} (was ${value(
// info.minSizeBefore,
// )}${info.lastVersion
// ? ` in version ${info.lastVersion}`
// : ' in last build'
// })`,
// ]
// :
[`${info.minSize}`]
: []),
// ...(info.gzipSize
// ? info.gzipSizeBefore
// ? [
// `${title('Gzipped Size: ')} ${value(info.gzipSize)} (was ${value(
// info.gzipSizeBefore,
// )}${info.lastVersion
// ? ` in version ${info.lastVersion}`
// : ' in last build'
// })`,
// ]
// : [`${title('Gzipped Size: ')} ${value(info.gzipSize)}`]
// : []),
// ...(info.brotliSize
// ? info.brotliSizeBefore
// ? [
// `${title('Brotli size: ')}${value(info.brotliSize)} (was ${value(
// info.brotliSizeBefore,
// )}${info.lastVersion
// ? ` in version ${info.lastVersion}`
// : ' in last build'
// })`,
// ]
// : [`${title('Brotli size: ')}${value(info.brotliSize)}`]
// : []),
]
return `${chalk.cyan(chalk.bold(values[0]))}: bundle size ${chalk.yellow(
values[1]
)} -> minified ${chalk.green(values[2])}`
}