Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(content): fix root.startups key (2) #20767

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

fix(content): fix root.startups key (2) #20767

wants to merge 6 commits into from

Conversation

revolunet
Copy link
Member

@revolunet revolunet commented Sep 18, 2024

Suite de #20757

Pour les personnes qui ont + de 1 mission et une clé root.startups, ajoute root.startups dans la derniere mission si la SE n'est pas déjà dans une des missions

authorsFiles.forEach(async (file) => {
  const header = await getMarkdownFileHeader(path.join(authorsPath, file));
  if (header.data.startups && header.data.startups.length && header.data.missions && header.data.missions.length) {
    const missionsStartups = header.data.missions.flatMap((m) => m.startups || []);
    const rootStartups = header.data.startups;
    const lastMission = header.data.missions[header.data.missions.length - 1];
    if (Array.from(missionsStartups).length === 0) {
      lastMission.startups = rootStartups.sort();
    } else {
      const missingStartups = rootStartups.filter((x) => !missionsStartups.includes(x));
      lastMission.startups = uniq([...(lastMission.startups || []), ...missingStartups].sort());
    }
    delete header.data.startups;
    const doc = dumpYaml(header.data, header.content);
    fs.writeFileSync(path.join(authorsPath, file), doc);
  }
});

@revolunet revolunet marked this pull request as draft September 25, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants