]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - scripts/client-build-stats.ts
Stop using tsconfig register
[github/Chocobozzz/PeerTube.git] / scripts / client-build-stats.ts
1 import { readdir, stat } from 'fs-extra'
2 import { join } from 'path'
3 import { root } from '@shared/core-utils'
4
5 async function run () {
6 const result = {
7 app: await buildResult(join(root(), 'client', 'dist', 'en-US')),
8 embed: await buildResult(join(root(), 'client', 'dist', 'standalone', 'videos'))
9 }
10
11 console.log(JSON.stringify(result))
12 }
13
14 run()
15 .catch(err => console.error(err))
16
17 async function buildResult (path: string) {
18 const distFiles = await readdir(path)
19
20 const files: { name: string, size: number }[] = []
21
22 for (const file of distFiles) {
23 const filePath = join(path, file)
24
25 const statsResult = await stat(filePath)
26 files.push({
27 name: file,
28 size: statsResult.size
29 })
30 }
31
32 return files
33 }