Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Excluding specific files #31

Closed
hinok opened this issue Jan 27, 2017 · 4 comments
Closed

Feature request: Excluding specific files #31

hinok opened this issue Jan 27, 2017 · 4 comments

Comments

@hinok
Copy link
Contributor

hinok commented Jan 27, 2017

Hey,
It's just proposal of a new feature that could be very handy.

I would like to exclude some files which are added to generated index.js files, why?
I have a folder /icons witch contains all my icons (each icon is a react component).
In this folder I have also stories.js file (I'm using react-storybook). Now stories.js is always added to the end of the file and my storybook is broken.

I think that it could work also for other people in other more advanced cases.
I could implement it and add PR but before I would like to talk about proposed solutions.

1. Using a "special comment" in generated index.js file

// @create-index
// @create-index-ignore: [/stories.(js)$/]

export Abc from './Abc.js';
export Zxc from './Zxc.js';
export Qwe from './Qwe.js';

.2 Using a "special configuration file" .create-index inside a specific directory

.create-index

{
  ignore: [
    /stories.(js)$/
  ]
}
@hinok hinok changed the title Excluding specific files Feature request: Excluding specific files Jan 27, 2017
@gajus
Copy link
Owner

gajus commented Jan 29, 2017

I don't think it makes sense to use a configuration file (yes another dot-file in the project for no good reason).

I'd say a variation of providing configuration in comment is a good approach, e.g.

// @create-index {"ignore": ["stories.(js)$"]}
  1. We keep the // @create-index comment as it.
  2. We change the // @create-index check to allow arbitrary string to follow the comment.
  3. We require assume that anything that follows // @create-index (on the same line) is a configuration object (defined as JSON).

This needs to be done in two PRs: (1) enable the above logic, (2) add ignore configuration.

This is quite a substantial amount of work. Though, if you'd raise the PRs, I'd be happy to review and and publish it.

@advance512
Copy link

Was any work done on this feature?

@hinok
Copy link
Contributor Author

hinok commented Feb 19, 2017

@advance512 I had an unexpected problem with my health and I couldn't start working on it in the last few weeks. I think that I'll be able to start implementation in the next week.

@advance512
Copy link

Feel well, @hinok! Thanks for any help :)

hinok added a commit to hinok/create-index that referenced this issue Mar 12, 2017
- This commit add functionality to ignore files
based on provided regexps.
- in index.js config must be specified as below

    // @create-index {"ignore":["/foo.js"]}
hinok added a commit to hinok/create-index that referenced this issue Mar 13, 2017
- This commit add functionality to ignore files
based on provided regexps.
- in index.js config must be specified as below

    // @create-index {"ignore":["/foo.js"]}
hinok added a commit to hinok/create-index that referenced this issue Mar 13, 2017
- This commit add functionality to ignore files
based on provided regexps.
- in index.js config must be specified as below

    // @create-index {"ignore":["/foo.js"]}
hinok added a commit to hinok/create-index that referenced this issue Mar 13, 2017
- This commit add functionality to ignore files
based on provided regexps.
- in index.js config must be specified as below

    // @create-index {"ignore":["/foo.js"]}
hinok added a commit to hinok/create-index that referenced this issue Mar 13, 2017
- Add functionality to ignore files based on provided
regular expressions
- Support writeIndex and writeIndexCli
- in index.js config must be specified as below

    // @create-index {"ignore":["/foo.js"]}
@gajus gajus closed this as completed in bf45925 Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants