Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix client stats

Chocobozzzaf11f812aca2
diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml
index 37146a94c6..b6a4e42951 100644
--- a/.github/workflows/stats.yml
+++ b/.github/workflows/stats.yml
@@ -37,7 +37,7 @@ jobs:
- name: PeerTube client stats
if: github.event_name != 'pull_request'
run: |
- npm run client:build-stats > client-build-stats.json
+ npm run -s client:build-stats > client-build-stats.json
- name: PeerTube client lighthouse report
if: github.event_name != 'pull_request'
diff --git a/scripts/client-build-stats.ts b/scripts/client-build-stats.ts
index 3b26aa6474..d8958824f1 100644
--- a/scripts/client-build-stats.ts
+++ b/scripts/client-build-stats.ts
@@ -1,6 +1,6 @@
+import { root } from '@peertube/peertube-node-utils'
import { readdir, stat } from 'fs/promises'
import { join } from 'path'
-import { root } from '@peertube/peertube-node-utils'
async function run () {
const result = {
@@ -14,17 +14,21 @@ async function run () {
run()
.catch(err => console.error(err))
-async function buildResult (path: string) {
+async function buildResult (path: string, root = path) {
const distFiles = await readdir(path)
- const files: { name: string, size: number }[] = []
+ let files: { name: string, size: number }[] = []
for (const file of distFiles) {
const filePath = join(path, file)
const statsResult = await stat(filePath)
+ if (statsResult.isDirectory()) {
+ files = files.concat(await buildResult(filePath, root))
+ }
+
files.push({
- name: file,
+ name: filePath.replace(new RegExp(`^${root}/`), ''),
size: statsResult.size
})
}