2023-07-31 08:34:36 -04:00
|
|
|
import { readdir, stat } from 'fs/promises'
|
2021-02-10 10:16:46 -05:00
|
|
|
import { join } from 'path'
|
2023-07-31 08:34:36 -04:00
|
|
|
import { root } from '@peertube/peertube-node-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
|
|
|
|
}
|