mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-20 02:15:12 +00:00
Merge pull request #506 from tmeschter/251219-FixYamlParser
Look for assets in subdirectories
This commit is contained in:
@@ -161,14 +161,26 @@ function parseSkillMetadata(skillPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// List bundled assets (all files except SKILL.md)
|
||||
const assets = fs
|
||||
.readdirSync(skillPath)
|
||||
.filter((file) => {
|
||||
const filePath = path.join(skillPath, file);
|
||||
return file !== "SKILL.md" && fs.statSync(filePath).isFile();
|
||||
})
|
||||
.sort();
|
||||
// List bundled assets (all files except SKILL.md), recursing through subdirectories
|
||||
const getAllFiles = (dirPath, arrayOfFiles = []) => {
|
||||
const files = fs.readdirSync(dirPath);
|
||||
|
||||
files.forEach((file) => {
|
||||
const filePath = path.join(dirPath, file);
|
||||
if (fs.statSync(filePath).isDirectory()) {
|
||||
arrayOfFiles = getAllFiles(filePath, arrayOfFiles);
|
||||
} else {
|
||||
const relativePath = path.relative(skillPath, filePath);
|
||||
if (relativePath !== "SKILL.md") {
|
||||
arrayOfFiles.push(relativePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return arrayOfFiles;
|
||||
};
|
||||
|
||||
const assets = getAllFiles(skillPath).sort();
|
||||
|
||||
return {
|
||||
name: frontmatter.name,
|
||||
|
||||
Reference in New Issue
Block a user