Skip to content

Commit

Permalink
fix: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Aug 6, 2024
1 parent 5573b4c commit 1a64db3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions packages/astro/src/default/utils/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export async function getTutorial(): Promise<Tutorial> {
continue;
}

if (micromatch.isMatch(filename, lesson.data.template.visibleFiles, { format: formatTemplateFile })) {
if (micromatch.isMatch(filename, lesson.data.template.visibleFiles, { basename: true })) {
lesson.files[1].push(filename);
}
}
Expand Down Expand Up @@ -366,15 +366,6 @@ async function getFilesRefList(pathToFolder: string, base = CONTENT_DIR): Promis
return [filesRef, filePaths];
}

function formatTemplateFile(filename: string) {
// compare files without leading "/" so that patterns like ["src/index.js"] match "/src/index.js"
if (filename.startsWith('/')) {
return filename.substring(1);
}

return filename;
}

interface CollectionEntryTutorial {
id: string;
slug: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ terminal:
panels: ['terminal', 'output']
template:
name: default
visibleFiles: ['src/template-only-file.js']
visibleFiles: ['template-only-file.js']
---

# Kitchen Sink [Heading 1]
Expand Down

0 comments on commit 1a64db3

Please sign in to comment.