gajus / create-index

Creates ES6 ./index.js file in target directories that imports and exports all sibling files and directories.
Other
278 stars 87 forks source link

[bug] can't read file or folder with "-"? #57

Closed kud closed 4 years ago

kud commented 4 years ago

Hello,

I wanted to create an index of some files or folders with "-" and I saw that an empty index with just the banner was created.

So I tried to rename my folders or files and now it works.

image

As you can see, only the one without "-" worked.

kud commented 4 years ago

Oh okay, in fact you don't read the export but the name of the file, like I've got:

const getLangFromPathname = (pathname) => pathname.split("/")[1]

export default getLangFromPathname

I tought it was easy to get getLangFromPathname here where the file is named get-lang-from-pathname.js.

But as I think you read the name of the file, which is perfectly fine but a conversion from kebab-case to lowerCamelCase should be the trick.

gajus commented 4 years ago

No plan to support kebab-case. See previous discussions.

kud commented 4 years ago

Do you mind if I do a PR about this? or should I fork your project?

gajus commented 4 years ago

There were several PRs for this already. I think there are a few forks for this too.

kud commented 4 years ago

Yes, just saw "create-index-plus". Thank you for your time!