generact icon indicating copy to clipboard operation
generact copied to clipboard

The tool should pick up both capitalized and uncapitalized files

Open bl5ck opened this issue 6 years ago • 6 comments

My component folder have 5 files:

  • index.js
  • SignUp.js
  • signUp.styles.js
  • signUp.duck.js
  • signUp.saga.js and the cli only picks up SignUp.js and index.js (please correct me if I'm wrong, thanks).

I checked the getFiles function inside utils.js and saw that it could be tweaked a little bit to support detecting both capitalized and uncapitalized files. Any idea is highly appreciated.

bl5ck avatar Nov 24 '18 02:11 bl5ck

It should copy everything if you choose to replicate SignUp. Isn't it working for you?

diegohaz avatar Nov 24 '18 04:11 diegohaz

Ah, my bad wasn't detailed about it. It does copy everything, but it renamed only the SignUp and skipped signUp in file names and file content.

bl5ck avatar Nov 24 '18 06:11 bl5ck

Got it. Just out of curiosity, why have you named it signUp.styles.js, and not SignUp.styles.js?

Regardless, this doesn't seem to be a common structure. And I'm afraid that it could lead to false positives. Are you aware of any article or something that recommends this architecture?

diegohaz avatar Nov 24 '18 06:11 diegohaz

Actually, I decided it myself based on the willing to distinguish Component file and the others. So I didn't follow any architecture regarding that point.

bl5ck avatar Nov 24 '18 08:11 bl5ck

I have a similar problem: My components folder has the following structure:

-/components

  • /my-component
    • index.tsx (which exports the main component)
    • MyComponent.tsx(the component itself)
    • MyComponent.d.tsx(types for the component)
  • /other-component
    • ....

When running the generator, it offers me the double of the expected possible components to replicate from (I see both MyComponent and MyComponent.d as options — which I believe is wrong) and if I choose MyComponent, for example I say I want it to be called Test:

  • it asks me if I want to generate it into src/components/my-component
  • after correcting it to the parent folder, it just creates a single Test.tsx component, inside /components not creating a new folder and not creating the rest of the files...

antoniocapelo avatar Apr 22 '19 14:04 antoniocapelo

@antoniocapelo, did you find a solution to your problem?

I have a structure like:

/Boilerplate/Boilerplate.scss
/Boilerplate/Boilerplate.tsx
/Boilerplate/index.ts

but the tool only generates:

/Test.scss
/Test.tsx

strdr4605 avatar Jul 13 '22 15:07 strdr4605