···2222 // remove vagrant since we don't care about that
2323 .filter((job) => job.id !== 9686);
24242525- const skillsWithJobId = skills.map((skill) => ({
2525+ const skillTreeWithoutJobs = skills.map((skill) => ({
2626 id: skill.id,
2727 name: skill.name,
2828 icon: skill.icon,
···40404141 // here we should build the tree with just second and third jobs BUT
4242 // the skills array should contain skills from the 1st, 2nd and 3rd job
4343- const tree = refinedJobs
4343+ const finalTree = refinedJobs
4444 .map((job) => ({
4545 ...job,
4646 skills: [
4747 // we also get the skills for the parent, which should be the 1st job
4848- ...skillsWithJobId.filter((skill) => skill.job === job.parent),
4848+ ...skillTreeWithoutJobs.filter((skill) => skill.job === job.parent),
4949 // filter for the skills that belong to the job
5050- ...skillsWithJobId.filter((skill) => skill.job === job.id),
5050+ ...skillTreeWithoutJobs.filter((skill) => skill.job === job.id),
5151 ],
5252 }))
5353+ // remove the 1st jobs after combining skills
5354 .filter((job) => job.parent !== 9686);
54555556 await Bun.write(
5657 "./src/exports/skill-tree.json",
5757- JSON.stringify(tree, null, 2),
5858+ JSON.stringify(finalTree, null, 2),
5859 );
5960}
6061