Skip to content

Docs are unclear about how to monitor files in nested directories #157

@sgronblo

Description

@sgronblo

I wanted to monitor files inside a nested directory. Let's say src/app/entities/*.ts.

I tried using something like:

  const hashResult = await folderHash.hashElement(projectDir, {
    folders: {
      include: [
        'src/app/entities',
      ],
      matchPath: true,
      matchBasename: false,
    },
    files: {
      include: ['*.entity.ts'],
    },
    encoding: 'hex',
  })

But it didn't work since the nested directory segments are expected to match the include entries (eg. src is matched against src/app which doesn't match and therefore stops descending). Therefore I had to add separate entries for each level of nesting like this for it to work:

  const hashResult = await folderHash.hashElement(projectDir, {
    folders: {
      include: [
        'src',
        'src/app',
        'src/app/entities',
      ],
      matchPath: true,
      matchBasename: false,
    },
    files: {
      include: ['*.entity.ts'],
    },
    encoding: 'hex',
  })

It might be that I am just missing something or the support for nested include folders could be improved to handle this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions