mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-23 20:05: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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List bundled assets (all files except SKILL.md)
|
// List bundled assets (all files except SKILL.md), recursing through subdirectories
|
||||||
const assets = fs
|
const getAllFiles = (dirPath, arrayOfFiles = []) => {
|
||||||
.readdirSync(skillPath)
|
const files = fs.readdirSync(dirPath);
|
||||||
.filter((file) => {
|
|
||||||
const filePath = path.join(skillPath, file);
|
files.forEach((file) => {
|
||||||
return file !== "SKILL.md" && fs.statSync(filePath).isFile();
|
const filePath = path.join(dirPath, file);
|
||||||
})
|
if (fs.statSync(filePath).isDirectory()) {
|
||||||
.sort();
|
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 {
|
return {
|
||||||
name: frontmatter.name,
|
name: frontmatter.name,
|
||||||
|
|||||||
Reference in New Issue
Block a user