diegohaz / generact

Generate React components by replicating your own
https://git.io/generact
MIT License
1.48k stars 64 forks source link

String replace in copied file? #26

Open flybayer opened 5 years ago

flybayer commented 5 years ago

Tried this for the first time. I was expecting it to string replace all the names in the new file, but it seems that's not currently a feature unless something broke for me.

Is is something you'd consider?

  1. generact BigDogs
  2. Set new name SmallDogs
  3. generact auto replaces all versions of BigDog with SmallDog (so bigDog->smallDog, big_dog->small_dog, etc)
diegohaz commented 5 years ago

Probably related to https://github.com/diegohaz/generact/issues/14#issuecomment-326831291

I chose not to update those names because it could lead to false positives.

But it should replace all BigDogs words by SmallDogs. Isn't it working for you?

flybayer commented 5 years ago

No, it didn't rename anything. I manually passed it the path to events.ts, a mobx-state-tree store.

What about adding a CLI flag to replace all variants? If it doesn't replace all variants, it's quicker and easier for me to just do the normal copy/paste dance.