export function processProfiles()

in library/markdown-parser/handlers/profile.ts [28:45]


export function processProfiles(): Profile[] {
  if (fs.existsSync(profileDist)) {
    fs.rmSync(profileDist, { force: true, recursive: true });
  }
  mkdirSync(profileDist, { recursive: true });

  const profiles: Profile[] = [];

  readdirSync(profileSource).forEach(file => {
    const { name } = parseFileName(file);
    const profile = parseProfileFromBuffer(name, readFileSync(`${profileSource}/${name}.yaml`));
    writeFileSync(`${profileDist}/${profile.id}.json`, JSON.stringify(profile));
    profiles.push(profile);
  });

  writeFileSync(`${profileDist}/list.json`, JSON.stringify(profiles));
  return profiles;
}