Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 16 Nov 10:26
· 31 commits to main since this release
a8cf202

Minor Changes

  • 9d67bdf: Add getFiles and getDirectories to Directory.

  • 1bd1de3: Adds hasExtension method to File to help constrain the type:

    import { Directory } from 'renoun/file-system'
    
    const posts = new Directory<{
      mdx: { frontmatter: { title: string } }
    }>({
      path: 'posts',
    })
    
    const mdxFiles = await posts
      .getFiles()
      .filter((post) => post.hasExtension('mdx'))
  • 4d263fe: Add includeIndexAndReadme option to getEntries for controlling default filtering of index and readme files.

  • e09a837: Adds isFileWithExtension utility:

    const fileSystem = new VirtualFileSystem({
      'Button.tsx': '',
    })
    const directory = new Directory<{ tsx: { metadata: {} } }>({
      fileSystem,
    })
    const file = await directory.getFileOrThrow('Button')
    
    if (isFileWithExtension(file, 'tsx')) {
      // file is typed as File<{ tsx: { metadata: {} } }>
    }
  • a36058f: Add getEditPath method to JavaScriptFileExport.