2021-02-10 10:16:46 -05:00
|
|
|
import { readdir, stat } from 'fs-extra'
|
|
|
|
import { join } from 'path'
|
2021-11-02 14:11:20 -04:00
|
|
|
import { root } from '@shared/core-utils'
|
2021-02-10 10:16:46 -05:00
|
|
|
|
|
|
|
async function run () {
|
|
|
|
const result = {
|
|
|
|
app: await buildResult(join(root(), 'client', 'dist', 'en-US')),
|
|
|
|
embed: await buildResult(join(root(), 'client', 'dist', 'standalone', 'videos'))
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(JSON.stringify(result))
|
|
|
|
}
|
|
|
|
|
|
|
|
run()
|
|
|
|
.catch(err => console.error(err))
|
|
|
|
|
|
|
|
async function buildResult (path: string) {
|
|
|
|
const distFiles = await readdir(path)
|
|
|
|
|
2021-02-11 02:41:12 -05:00
|
|
|
const files: { name: string, size: number }[] = []
|
2021-02-10 10:16:46 -05:00
|
|
|
|
|
|
|
for (const file of distFiles) {
|
|
|
|
const filePath = join(path, file)
|
|
|
|
|
|
|
|
const statsResult = await stat(filePath)
|
2021-02-11 02:41:12 -05:00
|
|
|
files.push({
|
|
|
|
name: file,
|
|
|
|
size: statsResult.size
|
|
|
|
})
|
2021-02-10 10:16:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return files
|
|
|
|
}
|