Skip to content

Commit

Permalink
Update compileFilamentList.js
Browse files Browse the repository at this point in the history
  • Loading branch information
halfmanbear authored Aug 8, 2024
1 parent 9b9bdd0 commit 4bca19b
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/pages/Generator/compileFilamentList.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
export default function compileFilamentList() {
const filament = import.meta.glob('../../profiles/filaments/*.json');
return Promise.all(Object.keys(filament).map(async (key) => {
const profile = await filament[key]();
return {
"name": profile.name.replace("-OpenNept4une", ""),
"identifier": profile.name,
"profile": profile
}
}));
}
export default async function compileFilamentList() {
try {
const filaments = import.meta.glob('../../profiles/filaments/*.json');
const filamentList = await Promise.all(Object.keys(filaments).map(async (key) => {
const profile = await filaments[key]();
return {
name: profile.name.replace("-OpenNept4une", ""),
identifier: key.split('/').pop().replace('.json', ''), // Use the file name without the extension as identifier
profile: profile
};
}));
return filamentList;
} catch (error) {
console.error("Error compiling filament list:", error);
throw error;
}
}

0 comments on commit 4bca19b

Please sign in to comment.