aseemk / requireDir

Node.js helper to require() directories.
MIT License
484 stars 60 forks source link

Add filter #17

Closed tpgmartin closed 6 years ago

tpgmartin commented 9 years ago

This is in relation to this issue https://github.com/aseemk/requireDir/issues/14

lbeschastny commented 8 years ago

@tpgmartin great job! :+1: Your patch worked like a charm for me. Hope @aseemk will merge it soon.

aseemk commented 8 years ago

Thanks guys, and my apologies for the delay!

I'm just curious to understand the use case a bit more. Would you guys mind sharing what you ignore?

lbeschastny commented 8 years ago

@aseemk I have two very similar use-cases from two different projects.

1. Base class

Suppose, I have a models directory containing a bunch of similar classes (e.g. models for my DB ORM or for client-side MVC framework). One of those files contains a base class, used to build all other classes.

Now I want to add an index file to require all my classes (except for the base class). I don't want to require the base class for two reasons:

2. Having both generalized and ready-to-use root modules

Suppose, I have a models directory containing all my ORM models. But before I'll be able to use those modules, I should bootstrap them to some database.

Now I want to add two root modules to use them in different situations:

Later I'll use generalized factory module in my tests (to run them with different DB configurations), while the rest of my project will use already bootstrapped models provided by an index file.

But to do so I'll have to ignore my index file when reading my models directory from within the factory module.

trestletech commented 8 years ago

Thanks. Now depending on this fork for my project. Would love to see it merged in.

aseemk commented 8 years ago

Sorry folks, I've been unusually busy with both work and life for a sustained period of time now. I keep meaning to get to these PRs (and other projects), but don't find myself with the time + energy too often.

One thing I've done with another project is to invite one or two other people to be collaborators in the project and help maintain it. Anyone here interested in that?

I'd just ask that you be mindful of keeping this project focused, and not let it get too complex. E.g. I'm not 100% sure it's a good idea to accept all of the currently open PRs, but I haven't looked into them fully or thought deeply about it.

Apologies again for the delay, and thank you for understanding. =)

trestletech commented 8 years ago

No need to apologize; you're volunteering your time. I appreciate the offer to add a collaborator, but also don't have time to take on maintenance at the moment. Hopefully somebody will be able to pick this up.

Thanks again!

lbeschastny commented 8 years ago

So, any progress here?

By the way, another ignore implementation was submitted as a PR https://github.com/aseemk/requireDir/pull/31

aseemk commented 7 years ago

Hi there,

I'm sorry I haven't been timely in responding to these issues and PRs.

If you're interested in taking over the maintainer role for this project, please let me know.

More details: https://github.com/aseemk/requireDir/pull/31#issuecomment-255744987

Cheers, Aseem

yocontra commented 6 years ago

Hi (new maintainer) - I've merged https://github.com/aseemk/requireDir/pull/27 which does the same thing, and was the first PR submitted to solve this problem. You should be able to achieve the same functionality with that. I'll be publishing it to npm shortly.