A decentralized music tracking and discovery platform built on AT Protocol 馃幍
rocksky.app
spotify
atproto
lastfm
musicbrainz
scrobbling
listenbrainz
1import chalk from "chalk";
2import { readdirSync, statSync } from "fs";
3import { join } from "path";
4import { $ } from "zx";
5
6function getPklFilesRecursive(dir: string): string[] {
7 const entries = readdirSync(dir);
8 const files: string[] = [];
9
10 for (const entry of entries) {
11 const fullPath = join(dir, entry);
12 const stats = statSync(fullPath);
13
14 if (stats.isDirectory()) {
15 files.push(...getPklFilesRecursive(fullPath));
16 continue;
17 }
18
19 if (entry.endsWith(".pkl")) {
20 files.push(fullPath);
21 }
22 }
23
24 return files;
25}
26
27const files = await getPklFilesRecursive(join("pkl", "defs"));
28
29await Promise.all(
30 files.map(async (fullPath) => {
31 console.log(`pkl eval ${chalk.cyan(fullPath)}`);
32 await $`pkl eval -f json ${fullPath} > ${fullPath.replace(/\.pkl$/, ".json").replace(/pkl[\\\/]defs/g, "lexicons")}`;
33 })
34);